Add a custom right-click menu using jQuery
How do I make an add a custom right-click menu using jquery?
Inspired by something on Stack Overflow, this will allow you to have a custom right-click menu in certain areas of your application. For Example: Right clicking in the table will display the custom menu, as right-clicking off the table will display the browser's default menu.. What is a add a custom right-click menu using jquery? How do you make a add a custom right-click menu using jquery? This script and codes were developed by Ty Stelmach on 09 December 2022, Friday.
Add a custom right-click menu using jQuery - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Add a custom right-click menu using jQuery</title> <script src="https://code.jquery.com/jquery.min.js"></script> <link href="https://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" /> <script src="https://getbootstrap.com/dist/js/bootstrap.js"></script> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrap">
<div> <h1>Custom Right-Click Interface Menus</h1>
</div>
<table id="mt" class="table"> <thead> <tr> <th>#</th> <th>First Name</th> <th>Last Name</th> <th>Username</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Ty</td> <td>Stelmach</td> <td>@TyStelmach</td> </tr> <tr> <td>2</td> <td>Andy</td> <td>Hawkins</td> <td>@ahawkins</td> </tr> <tr> <td>3</td> <td>Lawrence</td> <td>Bird</td> <td>@LarryBird</td> </tr> <tr> <td>4</td> <td>Sally</td> <td>Saran</td> <td>@SalPal</td> </tr> <tr> <td>5</td> <td>Heather</td> <td>Long</td> <td>@HeatherLong</td> </tr> </tbody> </table> <div id="contextMenu" class="dropdown clearfix"> <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" style="display:block;position:static;margin-bottom:5px;"> <li><a tabindex="-1" href="#">Action 1</a> </li> <li><a tabindex="-1" href="#">Action 2</a> </li> <li><a tabindex="-1" href="#">Some More Actions</a> </li> <li class="divider"></li> <li><a tabindex="-1" href="#">Final Action</a> </li> </ul> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Add a custom right-click menu using jQuery - Script Codes CSS Codes
#contextMenu { position: absolute; display: none;
}
.wrap{ width:90%; display:block; margin:0 auto;
}
table{border:1px solid rgba(221, 221, 221, 1);}
tr:nth-child(even) {background: #F5F5F5}
tr{ position:relative;
}
tr:hover{ background:#c9e8f7; position:relative;
}
Add a custom right-click menu using jQuery - Script Codes JS Codes
$(function() { var $contextMenu = $("#contextMenu"); $("body").on("contextmenu", "table tr", function(e) { $contextMenu.css({ display: "block", left: e.pageX, top: e.pageY }); return false; }); $('html').click(function() { $contextMenu.hide(); });
});
Developer | Ty Stelmach |
Username | TyStelmach |
Uploaded | December 09, 2022 |
Rating | 3 |
Size | 2,476 Kb |
Views | 32,384 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Spotify layout and UI | 6,919 Kb |
Simple jQuery Text Slider | 3,560 Kb |
Adding content to an iframe with jQuery | 2,380 Kb |
Waffle-Ipsum | 3,038 Kb |
Lazy Load and Filter Resource Library | 2,800 Kb |
Angular Deluxe Task List | 5,711 Kb |
Fundraising Grader | 9,305 Kb |
Credit Card Payment Modal | 4,461 Kb |
Codepen recreation | 2,689 Kb |
Personal Celebration Module | 4,537 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Ripples in water | Nobitagit | 2,704 Kb |
Slide out Menu | Rbiggs | 4,936 Kb |
No Vacancy 404 CSS Only | Sethkontny | 0 Kb |
Under construction | GhostRider | 1,642 Kb |
Header | Er40 | 1,542 Kb |
Light Switch | Bartuc | 4,933 Kb |
Canvas Orbital Trails v2 | Jackrugile | 3,421 Kb |
A bit of elegance | Hackthevoid | 9,095 Kb |
Emberjs Bootstrap Modal Carousel | Somethingkindawierd | 4,233 Kb |
Javascript Welcome | Peterlewicki | 1,573 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!