views:

39

answers:

0

I'm trying to stop items being selected when the next button is clicked in the jCarousel plugin.

To see what I mean, have a look at this demo and double click the next arrow... jCarousel demo

I tried this code and it seems to work for IE and Mozilla but it doesn't work for Safari or 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); 

Any help appreciated.