user1170376
user1170376

Reputation: 23

jQuery hover and active state

I'm having some problems trying to make the hover and active state work on my website. I'm new to jQuery and I'm finding it difficult. This is the code that I currently have:

$(document).ready(function(){
   $('.st_tab').hover(function(){
   $(this).stop().animate({opacity : '0', left: '+=50',}, 100);
   }, function(){$(this).stop().animate({'opacity' : '1'}, 500);})

});

I want it to work like this example : http://www.queness.com/resources/html/fadein/index.html

I created a test page of site and you can see it here: http://jm-ai.com/test/index.html

I'm using a sprite image for the normal, hover, and active state.

The problem is that whenever I hover the animation disappears too quickly and when I click there is no animation.

Upvotes: 0

Views: 723

Answers (1)

Jonas m
Jonas m

Reputation: 2734

I would recommend mouseover mouseout. Make it fill a variable true false whenever it have been clicked.

$('.st_tab').mouseover(function() { //animation }).mouseout(function() { //animation });

Upvotes: 0

Related Questions