私は想像できるすべてを試しましたが、これを機能させることはできません...私はここでフィドルを作成しました: http://jsfiddle.net/DftyD/3/ (そこでは機能しません)
マウスオーバー時にムーブ関数を常に実行したい (マウスムーブで実行すると、クリック時にギャラリーのサイズが変更されるときに問題が発生する)
cont.bind('mouseenter', function() {
active = setInterval(moveit, 20); // WHAT IS WRONG HERE?
}).bind('mouseleave', function(){
active && clearInterval(active);
});
function moveit(e) {
var windowHeight = $(window).height();
var contWidth = cont.width();
var galWidth = lastImg[0].offsetLeft + lastImg.outerWidth();
var left = (e.pageX - cont.offset().left) * (galWidth - contWidth) / contWidth;
cont.scrollLeft(left);
};
私はjqueryが初めてなので、私のコードは少し面倒です。私の問題を理解していただければ幸いです。
ありがとうございました :)