Home  >  Article  >  Web Front-end  >  JavaScript CSS creates right-click menu effect code_navigation menu

JavaScript CSS creates right-click menu effect code_navigation menu

WBOY
WBOYOriginal
2016-05-16 18:57:591051browse

Rendering:
JavaScript CSS creates right-click menu effect code_navigation menu


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

Code explanation:
1. When the page is loading, first execute the load1() method
to first check whether it is IE browser. If the current browser is Internet Explorer, document.all will return true. Then the following definition should be valid. That is to say, when it is detected that the browser used by the client is IE, the function showmenuie5 is called when the user generates a right-click event, and the function hidemenuie5 is called when the user generates a left-click event.
2. Next we have to consider how to display and hide the menu through the function showmenuie5 and hidemenuie5.
Of course, the menu here is not a real right-click menu, but a div we made ourselves, and we put the things we want to put in this div. Call the function through mouse events to control its visibility, which achieves the same effect as using the right mouse button.
The outermost layer of this block is a div with the ID ie5menu. We have defined its style as skin0. You can also customize other styles and replace skin0.
3. Operations after clicking the menu option The jumptoie5() function implements what happens when the mouse clicks on the layer in the right-click menu, that is, the execution option
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn