2012-03-22 51 views
0

我目前使用Spritely在jQuery中创建动画。仅在mouseover上播放Spritely动画

我怎么会去了鼠标上播放动画一次,然后停在鼠标移出动画...

任何帮助将是巨大的感谢,这是当前的代码:

(function($) { 
      $('#booth').bind("mouseenter", function() { 
       $('#phone').sprite({fps: 24, no_of_frames: 36}) 
       $(this).unbind(); 
      }); 

      $('#booth').bind("mouseout", function() { 
       $(this).stop(); 
       $(this).unbind(); 
      }); 
     })(jQuery); 
+0

你还在寻找吗? – bottleboot 2012-04-24 10:02:12

回答

1

从兴致文档,它看起来像.spStop()是你想要的方式:

 $('#booth').bind("mouseout", function() { 
      $(this).spStop(); 
      $(this).unbind(); 
     }); 
+0

嘿感谢您的快速反应......但没有似乎没有工作..我仍然环顾四周.. – 2012-03-22 12:51:42

0

我认为你正在寻找.destroy()

使代码:

$('#booth').bind("mouseout", function() { 
    $(this).destroy(); 
     $(this).unbind(); 
});` 

我一直在使用它,以及破坏方法停止动画。