我使用this jquery plugin将dragscrollable-behavior附加到某些内容元素。现在我需要暂时禁用此功能。
插件文档没有提供这样的禁用方法所以我尝试了这些片段,但没有成功:
// bind plugin dragscrollable
$('.dragscrollable').dragscrollable();
// remove the identifier class - still dragscrollable
$('.dragscrollable').removeClass('dragscrollable');
// unbind mousemove/mousedown event handler - still dragscrollable
$('.dragscrollable').off('mousemove', 'mousedown');

然而,似乎无法实现此功能被禁用。有什么建议?它是一种病毒,一旦结合吗?
答案 0 :(得分:0)
找到解决方案。
编辑插件并添加到mouseMoveHandler:
mouseMoveHandler : function(event) { // User is dragging
// optional disable handler
if(lockDragscrollDisable == true) {
return false;
}
// ..
}
设置变量lockDragscrollDisable以禁用此功能。