Home >
front end > Right-click the event is to click on the div any position can be implemented, but now only a small p
Right-click the event is to click on the div any position can be implemented, but now only a small p
{{am. Num}} & lt;/p>
{{am. Name}} & lt;/p>
${{am. Money}} & lt;/p>
Var menu1=document. GetElementById (" myMenuVC1 ");
Var menu2=document. GetElementById (" myMenuVC2 ");
Var menu3=document. GetElementById (" myMenuVC3 ");
Var menu4=document. GetElementById (" myMenuVC4 ");
Var menu5=document. GetElementById (" myMenuVC5 ");
Var WWW=$(' roomlist li '), data (" WWW ");
Var room=$(' roomlist li ');
//var menu=document. GetElementById (" myMenuVC1 ");
For (var I=0; I & lt; Room. Length; I++) {
$(room). The bind (" contextmenu ", function (e) {
Var WWW=isEmpty ($(this). Attr (' data - WWW));
If (WWW) {
Var a=$(this). Attr (' data - WWW);
If (a==18) {
Window. Dataid=$(this). Attr (' data - id);//set the global variable
Window. The room;//set the global variable
Var a=$(this). Attr (' data - id);
Var e=e | | window. The event;
//the coordinates of the mouse point
Var OS x=e.c. with our fabrication: lientX;
Var oY=e.c. with our fabrication: lientY;
//position after the appearance of the menu
Menu1. Style. The display="block";
Menu1. Style. Left=OS x + "px";
Menu1. Style. The top=oY + "px";
return false;
{} else if (a==28)
Window. Dataid=$(this). Attr (' data - id);//set the global variable
Window. The room;//set the global variable
Var a=$(this). Attr (' data - id);
Var e=e | | window. The event;
//the coordinates of the mouse point
Var OS x=e.c. with our fabrication: lientX;
Var oY=e.c. with our fabrication: lientY;
//position after the appearance of the menu
Menu2. Style. The display="block";
Menu1. Style. The display="none";
Menu2. Style. Left=OS x + "px";
Menu2. Style. The top=oY + "px";
return false;
{38} else if (a==)
Window. Dataid=$(this). Attr (' data - id);//set the global variable
Window. The room;//set the global variable
Var a=$(this). Attr (' data - id);
Var e=e | | window. The event;
//the coordinates of the mouse point
Var OS x=e.c. with our fabrication: lientX;
Var oY=e.c. with our fabrication: lientY;
//position after the appearance of the menu
Menu3. Style. The display="block";
Menu1. Style. The display="none";
Menu3. Style. Left=OS x + "px";
Menu3. Style. The top=oY + "px";
return false;
{} else if (a==48)
Window. Dataid=$(this). Attr (' data - id);//set the global variable
Window. The room;//set the global variable
Var a=$(this). Attr (' data - id);
Var e=e | | window. The event;
//the coordinates of the mouse point
Var OS x=e.c. with our fabrication: lientX;
Var oY=e.c. with our fabrication: lientY;
//position after the appearance of the menu
Menu4. Style. The display="block";
Menu1. Style. The display="none";
Menu4. Style. Left=OS x + "px";
Menu4. Style. The top=oY + "px";
return false;
58)} else if (a=={
Window. Dataid=$(this). Attr (' data - id);//set the global variable
Window. The room;//set the global variable
Var a=$(this). Attr (' data - id);
Var e=e | | window. The event;
//the coordinates of the mouse point
Var OS x=e.c. with our fabrication: lientX;
Var oY=e.c. with our fabrication: lientY;
//position after the appearance of the menu
Menu5. Style. The display="block";
Menu1. Style. The display="none";
Menu5. Style. Left=OS x + "px";
Menu5. Style. The top=oY + "px";
return false;
}
}
//close menu
Document. The onclick=function (e) {
Var e=e | | window. The event;
Menu1. Style. The display="none";
Menu2. Style. The display="none";
Menu3. Style. The display="none";
Menu4. Style. The display="none";
Menu5. Style. The display="none";
}
});
}
//determine whether null value
The function isEmpty (value)
{
If (typeof (value)!="undefined" & amp; & The value!=' ')
{
return true;
} else {
return false;
}
}
CodePudding user response:
Either by judging whether the coordinates of the event object in the region of the trigger, or put inside a div plus right event
CodePudding user response:
Tried, still won't do