On the page there are several links, when you click a certain modifier is hung up. Tell me how to cancel the mousover on the link on which this very class is hanging.
Ie, if the link is a class - event :hover on it should not work.
|
1 answer
Here is an example, I think the essence will be clear
.test { width: 100px; height: 100px; border: 1px solid black; margin: 20px; } .test:not(.clear):hover { border: 1px solid red; background: gray; } <div class="test"></div> <div class="test clear"></div> Jquery implementation
$(function(){ $('.test').on('mouseenter', function(){ if(!$(this).hasClass('clear')){ $(this).css('background','gray'); } }).on('mouseleave', function(){ if(!$(this).hasClass('clear')){ $(this).css('background','none'); } }) }); .test { width: 100px; height: 100px; border: 1px solid black; margin: 20px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="test"></div> <div class="test clear"></div> - Thank you, I understood the essence with this example. But if it was a question of JS, it would be interesting to see how it is doubly for a language learner. - pepel_xD
- can i use jquery or net? - sivik_xes
|