【发布时间】:2013-08-09 02:18:55
【问题描述】:
这个问题看起来很奇怪,我检查了我的代码是否可以替换,但它们都给出了同样的问题。一个替换可以是 Jquery: mousedown effect (while left click is held down) 。 我正在尝试制作一个滑块,将图像的拇指向右或向左滑动。然后人们可以从拇指中选择并单击他想要的图像,它将显示出来。拇指可以左右滑动。 问题是单击右键后图像不会再次向左滑动,我认为这是 clearinterval 的东西。 这是小提琴,http://jsfiddle.net/2rfm5/18/ 点击右箭头后左滑效果不起作用。
$("#popUpInnerArrowLeft").mousedown(function(event) {
movetoleft();
});
var into ,into2 ;
function movetoleft() {
function moveit() {
$(".thumbsInnerContainer").animate({right:'+=10px'});
}
into = setInterval(function() { moveit(); }, 500);
}
$(document).mouseup(function(event) {
clearInterval(into);
});
//for the right arrow
$("#popUpInnerArrowRight").mousedown(function(event) {
movetoright();
});
function movetoright() {
function moveit2() {
$(".thumbsInnerContainer").animate({left:'+=10px'});
}
into2 = setInterval(function() { moveit2(); }, 500);
}
$(document).mouseup(function(event) {
clearInterval(into2);
});
【问题讨论】:
-
你能不能设置一个fiddle来试试这个。
-
jsfiddle.net/2rfm5/18@OptimusPrime
-
对我来说它向左和向右滑动,有变化,你还有什么问题?
-
按右箭头后不会向左滑动。
-
检查我的答案,希望对您有所帮助
标签: javascript jquery slider