CarouFredSel中TouchSwipe不支持带链接的元素

http://caroufredsel.dev7studios.com/configuration.php

caroufredsel 的配置页面里提到 swipe 这个属性:To enable this feature, you’ll need to include the jQuery.touchSwipe-plugin.

如果 HTML 结构是这样

<div class="image_carousel">
<ul id="carousel">
   <li><img src="slier.jpg"/><li>
   <li><img src="slider2.jpg"/><li>
</ul>
</div>

你可以这样使这个幻灯片支持touchswipe

<script>
    $("#carousel").carouFredSel({
        auto        : false,
	prev        : '#c-prev',
	next        : '#c-next',
        swipe       : {
                onTouch     : true,
                onMouse     : true
            }
    });
</script>

倘若这个幻灯片的图片带来链接:

<ul id="carousel">
   <li><a href="foo.html"><img src="kitten.jpg"/></a><li>
   <li><a href="foo.html"><img src="puppy.jpg"/></a><li>
</ul>

那这个就不起作用了。

这是因为 这个插件将一些元素排除了,查看代码可以发现:

excludedElements:"label, button, input, select, textarea, a, .noSwipe"

所以在处理带连接的情况,就需要重置一下 excludedElements, 例如:

$("#foo1").carouFredSel({
    	auto : false,
        items: 1,
        swipe       : {
            onTouch         : true,
            onMouse         : true,
            options         : {
                excludedElements: "button, input, select, textarea, .noSwipe"
            }
        },
	    prev : "#foo1_prev",
	    next : "#foo1_next"
});

可以在手机里打开下面的链接查看 http://jsfiddle.net/4uUKd/28/embedded/result,js,css,html/
或者扫描:
在线二维码生成器

还有另一个另一个jquery 插件,jQuery Touchwipe Plugin

这两个插件名字类似,但是功能却不尽一样。

导入这个插件后,我们可以这样实现:

$('#carousel').carouFredSel({
        width: '100%',
        prev: '#prev-propslider',
        next: '#next-propslider',
        swipe: true
});

$('#carousel').touchwipe({
        wipeLeft: function() {
            $('#carousel').trigger('next', 1);
        },
        wipeRight: function() {
            $('#carousel').trigger('prev', 1);
        }
});

这样就可以了,但是至于 touchSwipe 如何支持链接,一时还找不到方法。

1,134 thoughts on “CarouFredSel中TouchSwipe不支持带链接的元素

  1. Family Law

    I think other web site proprietors should take this web site as an model, very clean and fantastic user genial style and design, as well as the content. You’re an expert in this topic!

  2. Car Auctions In Maryland

    I was just seeking this information for some time. After 6 hours of continuous Googleing, finally I got it in your site. I wonder what’s the lack of Google strategy that do not rank this kind of informative websites in top of the list. Generally the top web sites are full of garbage.

  3. Small Business

    As I web site possessor I believe the content material here is rattling magnificent , appreciate it for your hard work. You should keep it up forever! Good Luck.

  4. pedophile

    Howdy! I just want to give you a big thumbs up for the great information you have got here on this post. I’ll be returning to your blog for more soon.

  5. homosexual

    Hello, i feel that i saw you visited my site thus i got here to go back the prefer?.I am trying to in finding issues to enhance my site!I suppose its ok to make use of some of your concepts!!

  6. Financial News

    We’re a group of volunteers and starting a new scheme in our community. Your website offered us with valuable info to work on. You have done an impressive job and our whole community will be thankful to you.

  7. Art Museum

    Hello.This article was really interesting, particularly because I was investigating for thoughts on this topic last Sunday.

  8. homosexual

    Hello there, I found your blog via Google at the same time as searching for a similar matter, your website came up, it looks great. I’ve bookmarked it in my google bookmarks.

  9. Business Website

    You made various nice points there. I did a search on the matter and found nearly all persons will agree with your blog.

  10. metal

    I like what you guys are up also. Such clever work and reporting! Carry on the superb works guys I¡¦ve incorporated you guys to my blogroll. I think it’ll improve the value of my site 🙂

  11. Common Law

    Great ¡V I should definitely pronounce, impressed with your site. I had no trouble navigating through all the tabs and related info ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or something, website theme . a tones way for your client to communicate. Nice task..

  12. About Contractor

    I precisely needed to thank you very much yet again. I do not know the things that I could possibly have used without the actual opinions revealed by you on that field. This was the frightening dilemma in my opinion, however , finding out the very skilled tactic you handled the issue made me to cry for contentment. Now i am thankful for the information and hope that you realize what a powerful job you are always carrying out educating other individuals all through a web site. I know that you haven’t got to know all of us.

  13. Barrister

    you are in reality a excellent webmaster. The web site loading speed is amazing. It sort of feels that you’re doing any unique trick. In addition, The contents are masterpiece. you have done a magnificent activity on this subject!

  14. Civil Law

    Thanks for some other magnificent article. The place else may just anybody get that type of info in such a perfect approach of writing? I’ve a presentation next week, and I am on the search for such info.

  15. Statutes

    Great paintings! This is the kind of information that are meant to be shared across the web. Shame on the search engines for no longer positioning this submit higher! Come on over and visit my web site . Thank you =)

  16. Solicitor

    Well I sincerely enjoyed reading it. This post procured by you is very useful for correct planning.

  17. Google

    Hey there. I discovered your blog via Google at the same time as looking for a comparable subject, your site got here up. It seems to be great. I have bookmarked it in my google bookmarks to visit then.

  18. Business News

    Magnificent beat ! I would like to apprentice while you amend your web site, how can i subscribe for a blog site? The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear idea

  19. Home Insurance

    I like the valuable info you provide in your articles. I will bookmark your weblog and check again here frequently. I’m quite certain I will learn lots of new stuff right here! Good luck for the next!

  20. Business Insider

    I have not checked in here for a while since I thought it was getting boring, but the last few posts are great quality so I guess I¡¦ll add you back to my daily bloglist. You deserve it my friend 🙂

  21. Car Insurance

    Thank you a lot for giving everyone such a memorable opportunity to read from this blog. It is always very brilliant and also packed with a great time for me and my office peers to visit your site a minimum of thrice every week to see the fresh issues you have got. Of course, I’m also usually satisfied concerning the amazing concepts you give. Some 4 areas in this article are unequivocally the very best I have ever had.

  22. Business News

    A lot of thanks for every one of your efforts on this web page. My aunt takes pleasure in setting aside time for investigation and it’s easy to see why. Almost all hear all concerning the lively manner you render good tactics by means of your blog and therefore attract response from other people on this subject while our own child is without question becoming educated a lot of things. Take advantage of the remaining portion of the new year. You have been doing a great job.

  23. What Equipment is Needed for Sling TV

    Hi! I know this is kinda off topic but I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest authoring a blog post
    or vice-versa? My site goes over a lot of the same topics as yours and I think we could greatly benefit from
    each other. If you might be interested feel free to send me an email.
    I look forward to hearing from you! Great blog by the way!

  24. Health Policy

    Thanks for every one of your work on this website. My mum really likes setting aside time for internet research and it is obvious why. My partner and i notice all concerning the powerful manner you convey sensible tips via this web site and in addition boost contribution from website visitors on this theme so my princess is without question being taught a whole lot. Have fun with the rest of the new year. You are doing a good job.

  25. Health Facts

    I think other site proprietors should take this site as an model, very clean and wonderful user friendly style and design, let alone the content. You are an expert in this topic!

  26. homosexual

    Hi there! I simply wish to offer you a big thumbs up for the excellent info you’ve got here on this post. I’ll be coming back to your website for more soon.

  27. homosexual

    Hello there, I discovered your site by means of Google whilst looking for a similar topic, your website came up, it appears good. I have bookmarked it in my google bookmarks.

  28. Sling TV

    Hello there, I discovered your site by means
    of Google whilst looking for a related topic, your website came up, it appears great.
    I have bookmarked it in my google bookmarks.
    Hi there, just changed into aware of your blog through Google,
    and found that it’s really informative. I’m going to watch out for brussels.
    I’ll appreciate if you happen to proceed this in future.

    Lots of people will likely be benefited from your writing.

    Cheers!

  29. Sling TV

    What’s up every one, here every person is sharing such knowledge,
    thus it’s fastidious to read this blog, and I used to pay
    a quick visit this webpage every day.

Comments are closed.