Tạo một lớp kiểu như thế này:
.unselectable {
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
-ms-user-select : none
}
Sau đó thay đổi Javascript hơi gán lớp này trên mousedown. Vì vậy, từ tập lệnh không thay đổi gì, nó sẽ trông như thế này.
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
});
});
Đối vô hiệu dao động bạn cần phải unbind sự kiện trên mousedown
như thế này:
$(this).unbind('mouseenter mouseleave');
Sau đó rebind chúng một lần nữa trên mouseup
như trên.
Điều đó đã làm nó, cảm ơn! – Wesley