我试图在 jCarousel 插件中单击下一个按钮时停止选择项目。
要明白我的意思,请查看此演示并双击下一个箭头... jCarousel demo
我尝试了这段代码,它似乎适用于 IE 和 Mozilla,但不适用于 Safari 或 Chrome...
/** * Fix carousel selection * http://chris-barr.com/entry/disable_text_selection_with_jquery/ */ (function($) { $.fn.disableTextSelect = function() { return this.each(function(){ if($.browser.mozilla){//Firefox $(this).css('MozUserSelect','none'); }else if($.browser.msie){//IE $(this).bind('selectstart',function(){return false;}); }else if($.browser.safari){//webkit $(this).css('KhtmlUserSelect','none'); }else{//Opera, etc. $(this).mousedown(function(){return false;}); } }); } $(function($){ $('.carousel-img').disableTextSelect();//No text selection for these elements }); })(jQuery);
感谢任何帮助。
最佳答案
您可以尝试this禁用TextSelect功能。
将其绑定(bind)到轮播按钮: $(".jcarousel-prev, .jcarousel-next").disableTextSelect();
关于javascript - jCarousel jQuery 插件 - 如何停止双击时选择项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3013493/