Created
August 7, 2014 08:35
-
-
Save harisenbon/430c1d39a522e8258b4f to your computer and use it in GitHub Desktop.
Prevent Selection or right-clicking on content
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 | |
.attr('unselectable', 'on') | |
.css('user-select', 'none') | |
.on('selectstart', false); | |
}; | |
$('body').disableSelection(); | |
$("body").bind("contextmenu",function(e){ | |
return false; | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment