jquery - How to NOT-click a href while dragging in iScroll -
jquery - How to NOT-click a href while dragging in iScroll -
i have iscroll enabled on my page.
notice images in scroller links (so popup opens bigger image, y'know deal). 1 of lovely features of iscroll can drag mouse scroll. now, when drags it, automatically opens image instead of scrolling bar. there workaround?
i append class each anchor while scroller beingness dragged. illustration append class name of "dragging" each anchor while beingness dragged remove class when dragging stops.
that means can add together preventdefault link has "dragging" class. along lines of:
myscroll1 = new iscroll('scroll1', { snap: 'li', momentum: false, hscrollbar: false, onscrollstart: function () { $('div#iscroll1 a').addclass("dragging"); }, onscrollend: function () { $('div#iscroll1 a').removeclass("dragging"); document.queryselector('.indicator > li.active').classname = ''; document.queryselector('.indicator > li:nth-child(' + (this.currpagex+1) + ')').classname = 'active'; } }); $('.dragging').click(function (e) { e.preventdefault(); }
this untested code may need refine selectors.
jquery hyperlink drag iscroll
Comments
Post a Comment