Home  >  Article  >  Web Front-end  >  XP style right-click menu_navigation menu implemented in js

XP style right-click menu_navigation menu implemented in js

WBOY
WBOYOriginal
2016-05-16 19:17:141235browse

Instructions for use:
Create a menu object before use
var obj = new MouseMenu("obj");
Note that obj must be the same as the obj of MouseMenu("obj")
If created After obj, then obj will have the following method, starting with obj.length = 0
method:
1. addMenu(express[,icon][,url][,target][,title]);
Function: Insert a menu and return a menu object with the same function as the mentioned obj
obj[obj.length] Then obj.length will be 1
Description:
express must be a string, Text displayed on the inserted menu
icon Optional, integer (>0), if there are options later and you don’t need ICON, fill in ""
url Optional, string, path
target is optional, the string is target
title is optional, the string is title
2. addLink(express,[,icon][,url][,target][,title])
Function: Insert a connection and obj.length will be 1
Description
express Required, string, the text displayed on the inserted menu
icon Optional, integer (>0), if there are options behind, If you don’t need ICON, fill in ""
url is required, string, path
target is optional, string is target
title is optional, string is title
3. addHR()
Function: Insert dividing line
Explanation:
It does not belong to the link and menu objects, so when used, obj.length remains unchanged
For example:
var MM = new MouseMenu("MM")
MM.addLink("Connect","","http://hello.com")
MM.addHR()
MM.addMenu("Menu")
//The following is MM [1] instead of MM[2] because MM.addHR() MM.length will not increase
MM[1].addLink("Connection","","http://hello.com")
Okay, after talking so much, you should be able to use it, right?
Suddenly someone asked: "Where to insert the connection..."
...Hmm~ This ^_^! Look at the above~~~~
Additional: other data in the code
/ /--------------- Relevant data ------------------//
var IconList = new Array(); // Collection of icon images, subscripts starting from 1
IconList[1] = new Image();
IconList[1].src = "icon/sub.gif";
//----- ----------------------- Sound switch ------ Sound switch ------------------ //
var mouseCanSound = true;
var menuSpeed ​​= 50; //----------Menu display speed------------//
var alphaStep = 30; //---------- Alphaha change degree -----------//

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