【发布时间】:2016-11-21 18:45:39
【问题描述】:
只有当点击按下并从上到下移动时才会增加或减少,这是正常操作。 我有这个脚本允许从输入增量和减量值拖动,这在 Firefox 中运行良好,但在 Chrome 中无法正常运行,任何人都可以纠正这个错误(在 Chrome 中)?
我的脚本也有问题。它只在 Firefox 中有效,但在 Chrome 中不一样。
示例:http://jsfiddle.net/iLen/bacx5qem/
视频:http://recordit.co/yW1NUPrXBP(左:chrome / 右:firefox)
var clicking = false;
$('.vamoAlSubibaja').mousedown(function() {
clicking = true;
});
$(document).mouseup(function() {
clicking = false;
})
var i = 0;
var y = 0;
$('.vamoAlSubibaja').mousemove(function(my) {
if (clicking == false) {
return
} else {
// change value
if (my.pageY <= $(this).offset().top + $('.vamoAlSubibaja').css('width').replace('px', '') / 10) {
y = parseInt($(this).val()) + 1;
$('.movestatus').text('plus');
} else {
y = parseInt($(this).val()) - 1;
$('.movestatus').text('minus');
}
$(this).val(parseInt(y));
i++;
}
});
【问题讨论】:
标签: javascript jquery html google-chrome