📄 context2.html
字号:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>DynarchMenu: context menus #2</title> <style type="text/css"> @import url("../src/skin-win2k.css"); body { background-color: #ccc; }</style> <script type="text/javascript"> // WARNING: the following should be a path relative to site, like "/hmenu/" // here it is set relative to the current page only, which is not recommended // for production usage; it's useful in this case though to make the demo work // correctly on local systems. _dynarch_menu_url = "../src/"; function ourActionHandler(action) { var item = action.info; var triggerElement = item.menu.target; alert("\"" + item.label + "\" clicked on the element having innerHTML:\n\"" + triggerElement.innerHTML + "\""); }; </script> <script type="text/javascript" src="../src/hmenu.js"></script> <style> .hotspot { position: absolute; border: 1px solid #f00; background-color: #fea; color: #000; padding: 10px; } </style> </head> <body onload="DynarchMenu.setup('menu', { context: true });" id="document"> <div class="hotspot context-align-bottom" style="left: 50px; top: 50px">This</div> <div class="hotspot context-align-right" style="left: 200px; top: 30px">menu</div> <div class="hotspot" style="left: 250px; top: 100px">is very</div> <div class="hotspot" style="left: 150px; top: 200px">cool</div> <div class="hotspot dynarch-menu-ctxbutton-left" style="left: 300px; top: 50px">left click here</div> <div class="hotspot dynarch-menu-ctxbutton-both" style="left: 350px; top: 100px">left or right click here</div> <h2 style="margin-top: 300px">Single [context] menu for multiple elements</h2> <p> This page demonstrates a feature of DynarchMenu which allows one to configure the same context menu for multiple elements. That's right, with one function call. </p> <p> The magic, again, is made through a special CSS class which is assigned to the LI element that defines the popup. Here we have set: </p> <pre><li class="context-class-<span style="color: #c55">div</span>-<span style="color: #f00">hotspot</span>"></pre> <p> And all <span style="color: #c55">div</span> elements having the class "<span style="color: #f00">hotspot</span>" will automagically be assigned a context menu. Please note that you also need to specify the tag name; if you want to have context menus on something else than DIV-s, say SPAN-s, then your class name will be: 鈥渃ontext-class-span-hotspot鈥
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -