【问题标题】:Need to add touch events?需要添加触摸事件?
【发布时间】:2017-11-20 19:07:21
【问题描述】:

所以我在添加触摸事件时遇到了一些麻烦,所以我可以让这个页面滑块工作。它适用于滚动鼠标和按键,但不适用于移动触摸。请参阅 codepen 链接中的代码....

<p data-height="265" data-theme-id="0" data-slug-hash="EyLWKg" data-default-tab="js,result" data-user="WispProxy" data-embed-version="2" data-pen-title="Gray & White - Skewed Slider with Scrolling" class="codepen">See the Pen <a href="https://codepen.io/WispProxy/pen/EyLWKg/">Gray & White - Skewed Slider with Scrolling</a> by Victor Belozyorov (<a href="https://codepen.io/WispProxy">@WispProxy</a>) on <a href="https://codepen.io">CodePen</a>.</p>

【问题讨论】:

    标签: javascript events mobile touch


    【解决方案1】:
    1. 确保您有 JQuery
    2. 将此添加到您的 JS 文件中

      $('.codepen a').on('click touch',function(){ 
        $('.codepen a').click(); 
       });
      

    【讨论】:

      猜你喜欢
      • 2011-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多