使用TouchSwipe的CarouFredSel插件的链接不起作用 [英] CarouFredSel Plugin using TouchSwipe with links not working
问题描述
我正在使用很棒的 CarouFredSel JQuery轮播插件,该插件包含用于集成用于手持设备的JQuery TouchSwipe 库。
I'm using the awesome CarouFredSel JQuery carousel plugin which includes features for integrating the JQuery TouchSwipe library for handheld devices as well.
轮播元素是div,div内是包裹在< ahref>
标记中的图像和文本。
The carousel elements are divs, within the div is an image and text wrapped in an <ahref>
tag.
一切正常,但我注意到,如果轮播元素(在本例中为div)包含链接,则对各种移动设备的滑动效果会不行。
Everything works as it should, but I've noticed that if the carousel element (in this case a div) includes a link, the swipe effect on various mobile devices does not work.
如果我删除图像/文本周围的链接,则滑动动作效果很好。几乎就像 preventDefault()
反向工作一样。如果删除图像周围的链接,而将文本保留为链接,则滑动仅适用于图像,而不适用于文本。
If I remove the link around the image/text, the swiping motion works fine. It's almost as if preventDefault()
is working in reverse. If I remove the link around the image, and leave the text as a link, the swiping works for the image, and not the text.
我可以轻松地单击该项目作为链接,如果它是链接,则无法滑动。
I can easily click the item as a link, I just cannot swipe if it IS a link.
有人特别遇到过CarouFredsel这个问题吗?
Has anyone experienced this problem with CarouFredsel in particular?
非常感谢。
推荐答案
默认情况下,元素禁用Touchswipe。
Touchswipe is disabled by default for a elements.
请参见 http://labs.rampinteractive.co.uk/touchSwipe/demos/Excluded_children.html
来自链接:
默认情况下,$。fn.swipe.defaults.excludedElements的值为按钮,输入,选择,textarea,a,.noSwipe ,要替换或清除列表,请重新设置excludeElements数组。作为补充,请执行以下操作(不要忘记开头的逗号)...
From the link: By default the value of $.fn.swipe.defaults.excludedElements is "button, input, select, textarea, a, .noSwipe, " To replace or clear the list, re set the excludedElements array. To append to it, do the following (dont forget the proceeding comma) ...
excludedElements:$.fn.swipe.defaults.excludedElements+", #some_other_div" });
我最终只是更改了插件中的默认设置,因为我所有的模态都是锚元素的子代。
I ended up just changing the defaults in the plugin, since all my modals were children of an anchor element.
excludedElements:"button, input, select, textarea, .noSwipe"
这篇关于使用TouchSwipe的CarouFredSel插件的链接不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!