2016-05-08 6 views
0

私は自分のページにスライダーを持っていて、マウスのホバーで停止し、もうマウスがないときにアニメーションを再開したいと思っています。マウスのホバーでアニメーションを停止する方法は?

私は.stopコマンドで何か試しましたが、動作させることはできませんでした。 誰かが私を助けてくれますか?任意のキューに入れられたアニメーションを削除するstop()使用clearQueue()

var $item = $('.carousel .item'); 
var $wHeight = $(window).height(); 
$item.eq(0).addClass('active'); 
$item.height($wHeight); 
$item.addClass('full-screen'); 

$('.carousel img').each(function() { 
    var $src = $(this).attr('src'); 
    var $color = $(this).attr('data-color'); 
    $(this).parent().css({ 
    'background-image' : 'url(' + $src + ')', 
    'background-color' : $color 
    }); 
    $(this).remove(); 
}); 

$(window).on('resize', function(){ 
    $wHeight = $(window).height(); 
    $item.height($wHeight); 
}); 

$('.carousel').carousel({ 
    interval: 2000, 
    pause: "false" 
}); 
$(this).stop(true); 
+0

どのカルーセルを使用しますか? – RRK

答えて

0

これを使用してください。

$('.carousel').hover(function() { 
    $(this).carousel('pause') 
}, function() { 
    $(this).carousel('cycle') 
}) 
+0

残念ながら、動作しません。 :/ –

関連する問題