jquery animation gets stuck
Hey all.
I'm using Jquery to create a rollover effect on 2 images (placed on top of each other) to fade the bottom image in on a mouseover and out on a mouse out. Clicking the faded in image also opens a fancybox gallery. The problem is that sometimes the animation (the fade in and out) gets stuck after closing the fancybox window and the mouseover doesn't work anymore.
here's my code for the mouseover:
- $(document).ready(function(){
- $(".appearing-image img").css("opacity",0).fadeTo(500, 0);
- $(".appearing-image img").mouseover(function ()
-
- {
- if ($(this).is(':animated'))
- {
- $(this).stop().fadeTo(250,1);
- }
- else
- {
- $(this).fadeTo(250, 1);
- }
-
-
- });
- $(".appearing-image img").mouseout(function () {
- if ($(this).is(':animated'))
- {
- $(this).stop().fadeTo(250,0);
- }
- else
- {
- $(this).fadeTo(250, 0);
- }
- });
and here's my html code:
- <div class="thumbnail" style="margin-top:1%; ">
- <div class="visible-image">
- <img src="images/projectslabel.jpg" />
- </div>
- <div class="appearing-image">
- <img onclick='$("a.projects:first").trigger("click");' src="images/projects.jpg" />
- </div>
- </div>
this has been giving me hastles for weeks now.
any help would be awesome!!
Dan