当在 jCarousel 插件中单击下一个按钮时,我试图停止选择项目。
要了解我的意思,请查看此演示并双击下一个箭头... jCarousel 演示
我尝试了这段代码,它似乎适用于 IE 和 Mozilla,但不适用于 Safari 或 Chrome……
/** * 修复轮播选择 * http://chris-barr.com/entry/disable_text_selection_with_jquery/ */ (函数($){ $.fn.disableTextSelect = function() { 返回 this.each(function(){ if($.browser.mozilla){//火狐 $(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{//歌剧等 $(this).mousedown(function(){return false;}); } }); } $(函数($){ $('.carousel-img').disableTextSelect();//对这些元素不选择文字 }); })(jQuery);
任何帮助表示赞赏。