JavascriptAPI right-click a map window

Source: Internet
Author: User

Right-click the map window and write the following javascript code into a separate script. You can directly introduce the html page of the map window:

Require (["dojo/ready", "dijit/Menu", "dijit/MenuItem", "dijit/CheckedMenuItem", "dijit/MenuSeparator", "dijit/PopupMenuItem"], function (ready, Menu, MenuItem, CheckedMenuItem, MenuSeparator, PopupMenuItem ){
Ready (function (){
Var pMenu;
PMenu = new Menu ({
TargetNodeIds: ["map"]
});
PMenu. addChild (new MenuItem ({
Label: "zoom in ",
OnClick: function () {alert ('zoomed in ')}
}));
PMenu. addChild (new MenuItem ({
Label: "zoom out ",
OnClick: function () {alert ('downsize ')}
}));
// PMenu. addChild (new MenuItem ({
// Label: "Menu Item With an icon ",
// IconClass: "dijitEditorIcon dijitEditorIconCut ",
// OnClick: function () {alert ('I was clicked ')}
//}));
// PMenu. addChild (new CheckedMenuItem ({
// Label: "checkable menu item"
//}));
// PMenu. addChild (new MenuSeparator ());

// Var pSubMenu = new Menu ();
// PSubMenu. addChild (new MenuItem ({
// Label: "Submenu item"
//}));
// PSubMenu. addChild (new MenuItem ({
// Label: "Submenu item"
//}));
// PMenu. addChild (new PopupMenuItem ({
// Label: "Submenu ",
// Popup: pSubMenu
//}));

PMenu. startup ();
});
});

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.