2011-09-07 8 views

Odpowiedz

6

Utwórz klasę stylu tak:

.unselectable { 
    -moz-user-select: none; 
    -khtml-user-select: none; 
    -webkit-user-select: none; 
    user-select: none; 
    -ms-user-select : none 
} 

Następnie zmienia Javascript lekko przypisać tej klasy na mousedown. Z tego niezmienionego scenariusza wyglądałoby to tak.

jQuery(function($){ 
    //Initialise 
    iPhoneAnimation.init(); 

    //Mouse down bind move event 
    $(".content-box").bind("mousedown", function(e){ 
      $(this).bind("mousemove", iPhoneAnimation.moveInfo); 
      $(this).addClass("unselectable"); // <-- ADD THIS 
    }); 

    //Unbind mouse event 
    $(".content-box").bind("mouseup", function(e){ 
     var $this = $(this); 

     $this.unbind("mousemove", iPhoneAnimation.moveInfo); 
     //Animate the panel 
     iPhoneAnimation.panelAnimate($this); 
     //Reset the private var 
     iPhoneAnimation.resetVars(); 

     $(this).removeClass("unselectable"); // <-- AND ADD THIS 
    }); 
}); 

wyłączania unosi trzeba rozpiąć zdarzenia na mousedown tak:

$(this).unbind('mouseenter mouseleave'); 

Następnie ponownie powiązać je ponownie mouseup jak wyżej.

+0

że to zrobił, dzięki! – Wesley

2
document.onmousemove = function(ev) 
{ 
    ev.preventDefault(); 
    /* 
    move it 
    */ 
} 
+0

To zadziałało dla mnie, dziękuję! –

0

chciałbym zakończyć odpowiedź Icchanobot za pomocą jednego więcej linii:

-ms-user-select : none 

Aby pracować z Internet Explorer 11/-