Created
December 9, 2011 08:10
-
-
Save azu/1450698 to your computer and use it in GitHub Desktop.
要素を選択範囲にできないようにする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.disableSelection = function () { | |
return this.each(function () { | |
$(this).attr('unselectable', 'on') | |
.css({'-moz-user-select':'none', | |
'-o-user-select':'none', | |
'-khtml-user-select':'none', | |
'-webkit-user-select':'none', | |
'-ms-user-select':'none', | |
'user-select':'none'}) | |
.each(function () { | |
$(this).attr('unselectable', 'on') | |
.bind('selectstart', function () { | |
return false; | |
}); | |
}); | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment