Initial commit
This commit is contained in:
91
FWA_MAIN/cmutemplate.html
Normal file
91
FWA_MAIN/cmutemplate.html
Normal file
@@ -0,0 +1,91 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>tmps</title>
|
||||
</head>
|
||||
<body>
|
||||
<!--context menu template-->
|
||||
<h1 style="text-align: center;">
|
||||
Welcome to Pharmacy.
|
||||
</h1>
|
||||
<h1 style="text-align: center;">
|
||||
Hi, We are creating a
|
||||
custom context menu here.
|
||||
</h1>
|
||||
<script type="text/javascript">
|
||||
document.oncontextmenu = rightClick;
|
||||
|
||||
function rightClick(clickEvent) {
|
||||
clickEvent.preventDefault();
|
||||
// return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="contextMenu" class="context-menu"
|
||||
style="display: none">
|
||||
<ul>
|
||||
<li><a href="#">Element-1</a></li>
|
||||
<li><a href="#">Element-2</a></li>
|
||||
<li><a href="#">Element-3</a></li>
|
||||
<li><a href="#">Element-4</a></li>
|
||||
<li><a href="#">Element-5</a></li>
|
||||
<li><a href="#">Element-6</a></li>
|
||||
<li><a href="#">Element-7</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
document.onclick = hideMenu;
|
||||
document.oncontextmenu = rightClick;
|
||||
|
||||
function hideMenu() {
|
||||
document.getElementById("contextMenu")
|
||||
.style.display = "none"
|
||||
}
|
||||
|
||||
function rightClick(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (document.getElementById("contextMenu").style.display == "block")
|
||||
hideMenu();
|
||||
else{
|
||||
var menu = document.getElementById("contextMenu")
|
||||
|
||||
menu.style.display = 'block';
|
||||
menu.style.left = e.pageX + "px";
|
||||
menu.style.top = e.pageY + "px";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.context-menu {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
background: lightgray;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.context-menu ul {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
min-width: 150px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.context-menu ul li {
|
||||
padding-bottom: 7px;
|
||||
padding-top: 7px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.context-menu ul li a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.context-menu ul li:hover {
|
||||
background: darkgray;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user