2012-07-04 104 views
0

我有一個簡單的滾動廣告;] 需要幫助惠特暫停懸停。asd scroller - 如何暫停懸停JS/jQuery

$(document).ready(function(mnmTicker){ 
    var mnmAdsInterval = 2000; 
/* Do not modify code below */ 
var mnmAdsLenght = m3ads_numberadverts; 
function mnmSlideAds(){ 
    hT = $('.someClass').find('a'); 
    hT2 = hT; 
    slideMargin = document.getElementsByClassName('a')[0].offsetHeight; 
    $(".someClass .a:first").clone().appendTo(".someClass"); 
    $(".someClass .a:first").animate({"marginTop":-+slideMargin,},1800, function(){ 
     $(this).remove(); 
    }); 

    }; 
    var interval = setInterval(mnmSlideAds, mnmAdsInterval); [/code] 

BTW。進出口檢驗這一點:

$('.someClass .a').hover(function() { 
     clearInterval(interval); 
    }, function() { 
     interval = setInterval(mnmSlideAds, mnmAdsInterval); 
    }); 

但不工作;/

回答

0

你只禁止區間,但需要stop()動畫太:

$('.someClass .a').hover(function() { 
    clearInterval(interval); 
    $(".someClass .a:first").stop(); 
}, function() { 
    interval = setInterval(mnmSlideAds, mnmAdsInterval); 
}); 
+0

THX,但在測試它不停止的時候; / – user1501342