12th section (Project Combat 2-desktop)

Source: Internet
Author: User

Note: Picture with jquery-1.11.1. Min.js can be downloaded online. <style type="Text/css"> *{margin:0;p adding:0;} Body{background:url ("images/bg.jpg"); Font-size:12px;font-family:"Microsoft Ya-Black"; color:#666;} /*Menu Start*/. Menu{width:200px;background: #fff; Box-shadow:1px 1px 40px #ccc;d Isplay:none;position:absolute;} . menu UL Li{list-style:none;line-height:36px;font-size:14px;padding-left:10px;border-bottom:1px solid #ddd;}            . Menu ul li:hover{background: #647E7C; color: #fff;} /*End Menu*/#zb {font-size:30px;color: #fff; text-Align:center;}</style><body> <!--menu Start--> <divclass="Menu"> <ul> <li onclick="Tz_menu (1);"> Add Apps </li> <li onclick="Tz_menu (2);"> Get courses </li> <li onclick="Tz_menu (3);"> Add notes </li> <li onclick="Tz_menu (4);"> Refresh </li> <li onclick="Tz_menu (5);"> Upload Data </li> <li onclick="Tz_menu (6);"> Change background </li> <li onclick="Tz_menu (7);"> Logout </li> </ul> </div> <!--end menu--> <p id="ZB"></p><script type="Text/javascript"Src="Js/jquery-1.11.1.min.js"></script><script type="Text/javascript">//Block Browser's own right-clickDocument.oncontextmenu =function () {return false; }    //Click the mouse button$ (document). MouseDown (function (e) {//mouse button 1 (left button), 2 mouse wheel, 3 right button        varKey =E.which; //Click the right mouse button        if(Key = =3){            varx = E.clientx;//x Horizontal            vary = e.clienty;//y ordinate//$ ("#zb"). HTML ("x =" + x + ", y =" + y "); Display coordinate values//Gets the width and height of the menu            varMenuheight = $ (". Menu"). Height (); varMenuwidth = $ (". Menu"). width (); //get the browser's visible height and width            varClientHeight =getclientheight (); varClientWidth =getclientwidth (); //Judging            if(Menuheight + y >clientheight) {y= Clientheight-menuheight-5; }            if(Menuwidth + x >clientwidth) {x= Clientwidth-menuwidth-5; }            $(". Menu"). Show (). CSS ({left:x,top:y});    }    }); //Click the blank area to hide the right mouse button$ (document). Click (function () {$ (". Menu"). Hide ();        }); //Click on each right button to execute the methodfunction Tz_menu (i) {if(i = =1) {alert ("Add an app"); } Else if(i = =2) {alert ("Get a course"); }    }        //browser's Visible heightfunction Getclientheight () {varClientHeight =0; if(Document.body.clientHeight &&document.documentElement.clientHeight) {clientheight= (Document.body.clientHeight < document.documentElement.clientHeight)?Document.body.clientHeight:document.documentElement.clientHeight; } Else{clientheight= (Document.body.clientHeight > Document.documentElement.clientHeight)?Document.body.clientHeight:document.documentElement.clientHeight; }        returnclientheight; }    //browser's visible widthfunction Getclientwidth () {varClientWidth =0; if(Document.body.clientWidth &&document.documentElement.clientWidth) {clientwidth= (Document.body.clientWidth < document.documentElement.clientWidth)?Document.body.clientWidth:document.documentElement.clientWidth; } Else{clientwidth= (Document.body.clientWidth > Document.documentElement.clientWidth)?Document.body.clientWidth:document.documentElement.clientWidth; }        returnclientwidth; }</script></body>

Effect:

12th section (Project Combat 2-desktop)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.