Skip to content

In this tutorial we will be creating custom Context menu / Right click menu using HTML, CSS and JavaScript

Notifications You must be signed in to change notification settings

CodeWithNiranjan/Context-menu-using-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Context / Right click menu using HTML, CSS and JavaScript

In this tutorial we will be learning how to create custom cotext menu using HTML, CSS and JavaScript

Usage

//JavScript Code
//Download this repository for full code

window.addEventListener("contextmenu",function(event){
  event.preventDefault();
  var contextElement = document.getElementById("context-menu");
  contextElement.style.top = event.offsetY + "px";
  contextElement.style.left = event.offsetX + "px";
  contextElement.classList.add("active");
});
window.addEventListener("click",function(){
  document.getElementById("context-menu").classList.remove("active");
});

Subscribe

Please subscribe CodeWithNiranjan

Thank You

About

In this tutorial we will be creating custom Context menu / Right click menu using HTML, CSS and JavaScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published