[Jquery] jQuery·Î ¿ìŬ¸¯ ¹æÁö, µå·¡±× ¹æÁö, ¼±Åà ¹æÁö (IE10, ÆÄÀÌ¾îÆø½º, Å©·Ò È®ÀÎ) |
|
|
 |
5³â Àü |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://code.jquery.com/jquery-1.11.0.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//¿ìŬ¸¯ ¹æÁö
/*
$(document).on("contextmenu",function(e){
console.log("c"+e);
return false;
});
//µå·¡±× ¹æÁö
$(document).on("dragstart",function(e){
console.log("d"+e);
return false;
});
//¼±Åà ¹æÁö
$(document).on("selectstart",function(e){
console.log("s"+e);
return false;
});
*/
//´ÙÀ½°ú °°ÀÌ À̺¥Æ®¸¦ Çѹø¿¡ µî·Ï°¡´É
$(document).on("contextmenu dragstart selectstart",function(e){
return false;
});
//Âü°í. IE¿¡¼´Â ÅØ½ºÆ®ÄÁÆ®·Ñ¹Ú½ºÀÇ ³»¿ëÀ» µå·¡±×ÇØ¼ ¼±ÅÃÇÒ¼ö¾ø¾úÀ½
// ¶ÇÇÑ ÆÄÀÌ¾îÆø½º¿¡¼´Â selectstart ½Ã À̺¥Æ®°¡ ¹ß»ýµÇÁö ¾Ê¾ÒÀ½.
//disableSelection($("body")[0])
});
//¼±Åà ¹æÁö. (ÆÄÀÌ¾îÆø½ºµµ Àû¿ëµÊ)
function disableSelection(target)
{
//For IE This code will work
if (typeof target.onselectstart!="undefined")
target.onselectstart=function(){return false}
//For Firefox This code will work
else if (typeof target.style.MozUserSelect!="undefined")
target.style.MozUserSelect="none"
//All other (ie: Opera) This code will work
else
target.onmousedown=function(){return false}
target.style.cursor = "default";
}
</script>
</head>
<body>
<input type="text"/><br>
¸¶¿ì½º ¿ìŬ¸¯, µå·¡±×, ¼±Åà ¹æÁö Å×½ºÆ®
</body>
</html> |
|
̵̧ : 245 |
̵̧
¸ñ·Ï
|
|