jquery nicescroll and touchbehavior issues



所以我使用的是jquery nicewoll插件,并且喜欢它支持带有选项的触摸设备:

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,
});

欢迎任何帮助或建议。

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

$( '#something' ).niceScroll
(
 {
  emulatetouch: true,
  cursordragontouch: true
 }
);

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

touchbehavior: true,
preventmultitouchscrolling: false, 

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

这对我很管用!

    zindex: 9999,
    emulatetouch: true,
    cursordragontouch: true,
    touchbehavior: true,
    preventmultitouchscrolling: false,

最新更新