jQuery .hasClass method to omit effect

Posted by Jonny Wood on Stack Overflow See other posts from Stack Overflow or by Jonny Wood
Published on 2010-06-09T16:48:26Z Indexed on 2010/06/09 16:52 UTC
Read the original article Hit count: 188

Filed under:
|

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'})
 });

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about class