Create menu for add-on button
I am a newbie in Firefox extension development and I intend to start creating an add开发者_如何学运维-on using the beta version of the add-on builder. So far using the getting started tutorial I managed to create a button on the add-on bar, that when clicked opens a new tab. The code is below:
require("widget").Widget({
id: "widgetID1",
label: "Get Involved",
contentURL: "http://site.com/image.png",
onClick: function(event) {
require("tabs").open("http://www.mozilla.org");
}
});
I would like to know how to create a menu for the extension, so when the button is clicked a menu appears. Perhaps some guidance towards some documentation on this matter would be most useful.
You can associate a panel to a widget, and put a <ul>
or <ol>
in the panel.
https://addons.mozilla.org/en-US/developers/docs/sdk/1.0/packages/addon-kit/docs/panel.html http://blog.mozilla.com/addons/2011/08/11/add-on-sdk-faq-widgets-panels/
精彩评论