[英]How to scroll horizontally with mouse drag?
我正在处理像看板这样的任务。 一切正常,但是当我单击垂直滚动条时,它会隐藏并且我无法上下滚动。
我正在使用以下代码在拖动时水平滚动
$('.at-priortyboxsholder').mousedown(function (event) {
$(this)
.data('down', true)
.data('x', event.clientX)
.data('scrollLeft', this.scrollLeft)
.addClass("dragging");
$(this).css('overflow','hidden')
return false;
}).mouseup(function (event) {
$(this)
.data('down', false)
.removeClass("dragging");
}).mousemove(function (event) {
if ($(this).data('down') == true) {
this.scrollLeft = $(this).data('scrollLeft') + $(this).data('x') - event.clientX;
}
}).mouseout(function() {
$(this).css('overflow','auto')
});
我已经通过更新代码解决了我的问题
$('.at-priortyboxsholder').mousedown(function (event) {
$(this)
.data('down', true)
.data('x', event.clientX)
.data('scrollLeft', this.scrollLeft)
.addClass("dragging");
}).mouseup(function (event) {
$(this)
.data('down', false)
.removeClass("dragging");
}).mousemove(function (event) {
if ($(this).data('down') == true) {
$(this).css('overflow','hidden')
this.scrollLeft = $(this).data('scrollLeft') + $(this).data('x') - event.clientX;
}
}).mouseout(function() {
$(this).css('overflow','auto')
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.