Javascript 如何使用鼠标拖动水平滚动?

Javascript 如何使用鼠标拖动水平滚动?,javascript,jquery,Javascript,Jquery,我正在做看板板之类的工作。一切正常,但当我点击垂直滚动条时,它隐藏了,我无法上下滚动。 我使用下面的代码在拖动时水平滚动 $('.at-priortyboxsholder').mousedown(function (event) { $(this) .data('down', true) .data('x', event.clientX) .data('scrollLeft', this.scrollLef

我正在做看板板之类的工作。一切正常,但当我点击垂直滚动条时,它隐藏了,我无法上下滚动。

我使用下面的代码在拖动时水平滚动

$('.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')
        });