こんにちは私は、WebサイトのJSクライアントスライダーに問題があります。JSスライダーon mouseover/mouseleft
私はmouseover
の間にそれを停止し、mouseleft
の間に再開します。コードを検索してチェックしましたが、なぜそれがまだ機能しないのか分からない、誰かが私を助けることができますか?
$(function(){
var $clientcarousel = $('#clients-list');
var clients = $clientcarousel.children().length;
var clientwidth = (clients * 400); // 140px width for each client item
$clientcarousel.css('width',clientwidth);
var rotating = true;
var clientspeed = 0;
var seeclients = setInterval(rotateClients, clientspeed);
function rotateClients() {
if(rotating != false) {
var $first = $('#clients-list li:first');
$first.animate({ 'margin-left': '-220px' }, 5000, "linear", function() {
$first.remove().css({ 'margin-left': '0px' });
$('#clients-list li:last').after($first);
});
}
}
});
$(document).on({
mouseover: function(){
rotating = false; // turn off rotation when hovering
},
mouseleave: function(){
rotating = true;
}
}, '#clients');
'mouseover:function()'の代わりに 'mouseenter:function()'を試してみることができます – vijayP
回答ありがとうございますが、それでも動作しません –
ここでフィドルや作業スニペットを作成してください。 – vijayP