• javascriptAPI 地图窗口任意位置右键显示菜单功能


    地图窗口任意位置右键显示菜单功能,把如下javascript代码写入单独的脚本,直接引入map窗口所在的html页面即可:

    Creation from markup is even easier. This example creates a context menu for the whole window.

    dojo.require("dijit.Menu");
    dojo.require("dijit.ColorPalette");
    <div data-dojo-type="dijit.Menu" id="windowContextMenu" data-dojo-props="contextMenuForWindow:true" style="display: none;">
        <div data-dojo-type="dijit.MenuItem" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconCut',
            onClick:function(){alert('not actually cutting anything, just a test!')}">Cut</div>
        <div data-dojo-type="dijit.MenuItem" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconCopy',
            onClick:function(){alert('not actually copying anything, just a test!')}">Copy</div>
        <div data-dojo-type="dijit.MenuItem" data-dojo-props="iconClass:'dijitEditorIcon dijitEditorIconPaste',
            onClick:function(){alert('not actually pasting anything, just a test!')}">Paste</div>
        <div data-dojo-type="dijit.MenuSeparator"></div>
        <div data-dojo-type="dijit.PopupMenuItem">
            <span>Enabled Submenu</span>
            <div data-dojo-type="dijit.Menu" id="submenu1">
                <div data-dojo-type="dijit.MenuItem" data-dojo-props="onClick:function(){alert('Submenu 1!')}">Submenu Item One</div>
                <div data-dojo-type="dijit.MenuItem" data-dojo-props="onClick:function(){alert('Submenu 2!')}">Submenu Item Two</div>
            </div>
        </div>
        <div data-dojo-type="dijit.PopupMenuItem">
            <span>Popup of something other than a menu</span>
            <div data-dojo-type="dijit.ColorPalette"></div>
        </div>
    </div>
    
    <span>Right click anywhere on this page to see a menu</span>

    Note that popup menus should be hidden via specifying style=”display: none”.Hiding the menu indirectly via a class won’t work (in that the menu will remain invisible even when it’s supposed to be displayed).

    原文链接:http://dojotoolkit.org/reference-guide/1.7/dijit/Menu.html

  • 相关阅读:
    将Excel文件转换为Html
    怎样录制屏幕并将结果保存为Gif
    Spire.Pdf 的各种操作总结
    在C#中使用Spire.doc对word的操作总结
    使用Spire.Barcode程序库生成二维码
    【BZOJ1304】[CQOI2009]叶子的染色(动态规划)
    【BZOJ1303】[CQOI2009]中位数图(模拟)
    【BZOJ1297】[SCOI2009]迷路(矩阵快速幂)
    【BZOJ1296】[SCOI2009]粉刷匠(动态规划)
    【BZOJ1295】[SCOI2009]最长距离(最短路)
  • 原文地址:https://www.cnblogs.com/dwf07223/p/3028008.html
Copyright © 2020-2023  润新知