禁用iScroll上的链接

时间:2014-07-08 08:58:17

标签: javascript jquery iscroll

我正在尝试在内容滚动时禁用图库图片的链接。这就是代码的样子:

HTML:

 <div class="post-box col-md-3 col-sm-4">
        <a href="images/fota2.jpg" class="swipebox img-responsive" title="My Caption">
          <img src="images/fota2.jpg" alt="image" class="img-responsive"/>
        </a>
    </div>

JS:

 <script type="text/javascript">
    var myScroll;
    function loaded() {
            myScroll = new iScroll('wrapper');           
            $('.dragging').click(function (e) {
            e.preventDefault();            
               myScroll.on('scrollStart', function () {
           $('.swipebox').addClass('dragging');
       });
            myScroll.on('scrollEnd', function () {
            $('.swipebox').removeClass('dragging');
        });

        });
    }
    document.addEventListener('DOMContentLoaded', loaded, false);
    </script>

不幸的是,代码并没有改变一件事。知道应该改变什么吗?

0 个答案:

没有答案