I've created a simple background effect for some tabs on a page but don't want that effect to fire if the tab has the class 'current'.
I presume there is a way to do this using .hasClass
Here's what I'm using for the effect:
$('ul.htabs a').mouseover(function(){
$(this).stop().animate(
{backgroundPosition:"(0 -810px)"},
{duration:150},
{easing: 'easeOutCubic'})
}).mouseout(function(){
$(this).stop().animate(
{backgroundPosition:"(0 -806px)"},
{duration:150},
{easing: 'easeInCubic'})
});
You could also put it in the selector:
$('ul.htabs:not(.current) a').mouseover(function(){ ... });
.mouseover(function(e) {
if ( $(this).hasClass('lol') ) {
return;
}
if the element has a class of lol kill the function by returning immediately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With