code: function startDrag(e) {
        // Preventing the event's default action stops text being
        // selectable during the drag.
        e.preventDefault();
  
        var self = $(this);
        self.trigger('startDrag');
  
        // Measure how far the user's mouse is from the top of the scrollbar drag handle.
        var eventOffset = e.pageY;
        if (scrollDirection === 'horiz') {
          eventOffset = e.pageX;
        }
        dragOffset = eventOffset - $dragHandleEl.offset()[offsetAttr];
  
        $(document).on('mousemove', drag);
        $(document).on('mouseup', function() {
          endDrag.call(self);
        });
      }
docs: Start scrollbar handle drag