"Material Design Context Menu"
Pure CSS 1.0.0 Snippet by selimdoyranli

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<link href="//cdnjs.cloudflare.com/ajax/libs/pure/1.0.0/pure-min.css" rel="stylesheet" id="bootstrap-css">
<script src=""></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<!-- material icon-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<!--RKcontextmenu-->
<div class="RKcontextmenu">
<ul>
<li><a href="javascript:void(0);" onclick="window.location.reload();"><i class="material-icons">refresh</i>Refresh</a></li>
<li><a href="javascript:void(0);" onclick="window.history.back(-1);"><i class="material-icons">arrow_back</i>Back</a></li>
<li><a href="https://www.facebook.com/radkodcom" target="_blank"><i class="material-icons">pages</i>RadKod Facebook Profile</a></li>
<li><a href="https://www.twitter.com/radkodcom" target="_blank"><i class="material-icons">pages</i>RadKod Twitter Profile</a></li>
<li><a href="https://www.instagram.com/freelancewebtasarim" target="_blank"><i class="material-icons">pages</i>RadKod İnstagram Profile</a></li>
<li><a href="https://selimdoyranli.com" target="_blank"><i class="material-icons">person_outline</i>Selim Doyranlı Website</a></li>
<li><a href="https://www.radkod.com" target="_blank"><i class="material-icons">public</i>RadKod Website</a></li>
</ul>
</div>
</body>
</html>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* ignore this */
@import url("https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin-ext");
body {
background: #eee;
}
body:after {
content: "Right Click";
font-size: 2em;
font-family: "Roboto", sans-serif;
color: #444;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* #### RKcontextmenu #### */
.RKcontextmenu {
display: none;
position: absolute;
width: 275px;
height: auto;
background: #fff;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19);
z-index: 999;
font-family: "Roboto", sans-serif;
}
.RKcontextmenu ul {
margin: 0;
padding: 0;
}
.RKcontextmenu ul li {
list-style: none;
font-size: 14px;
}
.RKcontextmenu ul li:hover {
background: #f4f4f4;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//RKcontextmenu
$("html").on("contextmenu", function(e) {
e.preventDefault();
var menu = $(".RKcontextmenu");
//firstly hide
menu.hide();
var pageX = e.pageX;
var pageY = e.pageY;
menu.css({
top: pageY,
left: pageX
});
var mwidth = menu.width();
var mheight = menu.height();
var screenWidth = $(window).width();
var screenHeight = $(window).height();
var scrTop = $(window).scrollTop();
if (pageX + mwidth > screenWidth) {
menu.css({
left: pageX - mwidth
});
}
if (pageY + mheight > screenHeight + scrTop) {
menu.css({
top: pageY - mheight
});
}
//menu open
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: