1

所以我正在使用 jquery nicescroll插件,并且喜欢它支持带有选项的触摸设备的事实:

touchbehavior:true,

我已经启用了这个功能,因为触摸设备,因为我喜欢滚动鼠标点击和拖动。

但还有一些事情困扰着我。可滚动的 Div 包含链接和大量文本。链接是可点击的,但这touchbehavior会禁用真正困扰我的文本选择。我想继续选择启用文本。

除此之外,启用此touchbehavior功能后,您将无法再单击实际滚动条并将其向下拖动,这在默认计算机或笔记本电脑上确实令人困惑。是否可以同时具有触摸行为和可点击和可拖动的滚动条?

我所说的可以在这个链接上测试和编辑:http: //jsfiddle.net/P8cPZ/

代码如下所示;

html:

<div class="outer">
<div class="inner">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sit amet nisi non 
    felis fringilla dignissim non et diam. Fusce et molestie nibh, pulvinar 
     tincidunt felis. Aenean hendrerit non dolor in mollis. Sed vehicula felis 
    eget tempor bibendum. Praesent commodo pretium sodales. Integer sit amet 
    semper lacus. <a href="www.google.com" >Cras imperdiet lectus at 
    sapien tempus malesuada.</a>..........
</div>
</div>

脚本:

$(".outer").niceScroll({
    cursorwidth:"6px",
    cursorborder: "0px",
    bouncescroll: true,
    horizrailenabled: false,
    touchbehavior:true,
    grabcursorenabled: true,
});

欢迎任何帮助或建议。

4

4 回答 4

3

有一个选项 cursordragontouch。将其设置为TRUE,您的滚动条将照常工作。我的意思是你可以结合cursordragontouchemulatetouch

$( '#something' ).niceScroll
(
 {
  emulatetouch: true,
  cursordragontouch: true
 }
);
于 2014-04-18T20:14:22.077 回答
2

将 touchbehavior 设置为 true 并将 preventmultitouchscrolling 设置为 false。您将能够拖动和触发任何链接。

touchbehavior: true,
preventmultitouchscrolling: false, 
于 2015-01-13T13:18:55.690 回答
1

只有当您想在桌面上模拟触摸行为时,Touchbehavior 才适用。您应该将其设置为 false 或将其删除。(无论如何它的默认值都是假的)您不需要在桌面上使用它。触控设备自动内置触控支持。

于 2013-11-28T13:49:10.257 回答
1

这对我有用!

    zindex: 9999,
    emulatetouch: true,
    cursordragontouch: true,
    touchbehavior: true,
    preventmultitouchscrolling: false,
于 2019-06-17T20:39:47.807 回答