jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
121 lines (115 loc) • 6.27 kB
HTML
<html lang="en">
<head>
<meta name="keywords" content="jQuery Menu, Main Menu, Context Menu, Vertical Menu, Popup Menu, Menu, jqxMenu" />
<meta name="description" content="This demo demonstrates how to use the jqxMenu widget as a Context Menu. In order to display the jqxMenu as Context Menu, you need to set the 'mode' property to 'popup'. "/>
<title id='Description'>
This demo demonstrates how to use the jqxMenu widget as a Context Menu. In order to display the jqxMenu as Context Menu, you need to set the 'mode' property to 'popup'.
</title>
<link rel="stylesheet" href="../../../jqwidgets/styles/jqx.base.css" type="text/css" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" />
<script type="text/javascript" src="../../../scripts/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="../../../scripts/demos.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../../jqwidgets/jqxmenu.js"></script>
</head>
<body>
<div id='content'>
<script type="text/javascript">
$(document).ready(function () {
// Create a jqxMenu
var contextMenu = $("#jqxMenu").jqxMenu({ width: '120px', height: '140px', autoOpenPopup: false, mode: 'popup'});
// open the context menu when the user presses the mouse right button.
$("#jqxWidget").on('mousedown', function (event) {
var rightClick = isRightClick(event) || $.jqx.mobile.isTouchDevice();
if (rightClick) {
var scrollTop = $(window).scrollTop();
var scrollLeft = $(window).scrollLeft();
contextMenu.jqxMenu('open', parseInt(event.clientX) + 5 + scrollLeft, parseInt(event.clientY) + 5 + scrollTop);
return false;
}
});
// disable the default browser's context menu.
$(document).on('contextmenu', function (e) {
return false;
});
function isRightClick(event) {
var rightclick;
if (!event) var event = window.event;
if (event.which) rightclick = (event.which == 3);
else if (event.button) rightclick = (event.button == 2);
return rightclick;
}
});
</script>
<div id='jqxWidget' style='vertical-align: middle; text-align: center; background: #eee;
height: 400px; width: 400px;'>
<div id='jqxMenu'>
<ul>
<li><a href="#">Home</a></li>
<li>About Us
<ul>
<li><a href="#">History</a></li>
<li><a href="#">Our Vision</a></li>
<li><a href="#">The Team</a>
<ul>
<li><a href="#">Brigita</a></li>
<li><a href="#">John</a></li>
<li><a href="#">Michael</a></li>
<li><a href="#">Peter</a></li>
<li><a href="#">Sarah</a></li>
</ul>
</li>
<li><a href="#">Clients</a></li>
<li><a href="#">Testimonials</a></li>
<li><a href="#">Press</a></li>
<li><a href="#">FAQs</a></li>
</ul>
</li>
<li>Services
<ul>
<li><a href="#">Product Development</a></li>
<li><a href="#">Delivery</a></li>
<li><a href="#">Shop Online</a></li>
<li><a href="#">Support</a></li>
<li><a href="#">Training & Consulting</a></li>
</ul>
</li>
<li>Products
<ul>
<li><a href="#">New</a>
<ul>
<li><a href="#">Corporate Use</a></li>
<li><a href="#">Private Use</a></li>
</ul>
</li>
<li><a href="#">Used</a>
<ul>
<li><a href="#">Corporate Use</a></li>
<li><a href="#">Private Use</a></li>
</ul>
</li>
<li><a href="#">Featured</a></li>
<li><a href="#">Top Rated</a></li>
<li><a href="#">Prices</a></li>
</ul>
</li>
<li><a href="#">Contact Us</a>
<ul>
<li><a href="#">Enquiry Form</a></li>
<li><a href="#">Map & Driving Directions</a></li>
<li><a href="#">Your Feedback</a></li>
</ul>
</li>
</ul>
</div>
<span style='font-size: 14px; position: relative; top: 180px; font-family: Verdana Arial;'>
Right-Click here to Open the Menu </span>
</div>
</div>
<div style="position: absolute; bottom: 5px; right: 5px;">
<a href="https://www.jqwidgets.com/" alt="https://www.jqwidgets.com/"><img alt="https://www.jqwidgets.com/" title="https://www.jqwidgets.com/" src="https://www.jqwidgets.com/wp-content/design/i/logo-jqwidgets.png"/></a>
</div>
</body>
</html>