마우스 오른쪽 메뉴 보이기~ hybrid 적용 > jQuery / Script

본문 바로가기
gnb bg


jQuery / Script

jQuery / Script

마우스 오른쪽 메뉴 보이기~ hybrid 적용

첨부파일

본문

-------------------------------

<!--

$(document).ready(function() {



if ($("#test").addEventListener) {

$("#test").addEventListener('contextmenu', function(e) {

alert("You've tried to open context menu"); //here you draw your own menu

e.preventDefault();

}, false);

} else {

$('#sec_layout_cont').on('contextmenu', 'tr.test00', function() {

//alert("contextmenu"+event);

document.getElementById("rmenu").className = "drop_list_rmn";  

document.getElementById("rmenu").style.top =  mouseY(event) + 'px';

document.getElementById("rmenu").style.left = mouseX(event) -200 + 'px';


window.event.returnValue = false;

});

}

});




function mouseX(evt) {

if (evt.pageX) {

return evt.pageX;

} else if (evt.clientX) {

return evt.clientX + (document.documentElement.scrollLeft ?

   document.documentElement.scrollLeft :

   document.body.scrollLeft);

} else {

return null;

}

}


function mouseY(evt) {

if (evt.pageY) {

return evt.pageY;

} else if (evt.clientY) {

return evt.clientY + (document.documentElement.scrollTop ?

document.documentElement.scrollTop :

document.body.scrollTop);

} else {

return null;

}

}


// this is from another SO post...  

$(document).bind("click", function(event) {

document.getElementById("rmenu").className = "hide";

});



//-->

-------------------------------


------------------------------

<div class="drop_list_rmn hide" id="rmenu">

<ul>

<li><a href="#n">SPEC 변경</a></li>

<li><a href="#n">부가서비스</a></li>

<li><a href="#n">켜기</a></li>

<li class="off"><a href="#n">끄기</a></li>

<li class="off"><a href="#n">리부팅</a></li>

<li class="off"><a href="#n">VM 복제</a></li>

<li><a href="#n">VM Catalog</a></li>

<li><a href="#n">삭제</a></li>

</ul>

</div>

------------------------------


-----------------------------------

.drop_list_rmn {position:absolute; width:168px; border:solid 1px #ddd; border-radius:3px; padding:10px 0; background:#fff; z-index:10000 }

.drop_list_rmn > ul {}

.drop_list_rmn > ul > li {font-size:12px; font-weight:bold; padding:0; border-top:dashed 1px #ddd}

.drop_list_rmn > ul > li:first-child {border-top:none}

.drop_list_rmn ul.depth {padding:5px 0 0 0px;}

.drop_list_rmn ul.depth > li {font-weight:normal}

.drop_list_rmn a {display:block; color:#555;  padding:3px 0 3px 18px;}

.drop_list_rmn a:hover {color:#000;  background:url('../images/ico_brit.png') no-repeat 7px 13px; text-decoration:underline !important}

.drop_list_rmn > ul > li.off {background:#eee}

.drop_list_rmn > ul > li.off a {color:#ccc; text-decoration:none !important; cursor:default}

-----------------------------------

댓글목록

등록된 댓글이 없습니다.


Copyright 2005-2020 UNIDA_v7. All rights reserved.