使用定位面板在新的Jetpack API中 [英] Using positioning 'Panel' in new Jetpack API
问题描述
我现在正在使用Jetpack API的新版本,该版本允许您使用JS框架为Firefox创建插件.
I'm now using the new version of the Jetpack API of which allows you to create addons for Firefox using a JS framework.
面板"对象易于使用-但我一直在努力寻找一种放置它的方法.该文档仅声明( Jetpack Panel API )
The 'panel' object is easy to use - but I'm struggling to find a way to position it. The documentation simply states (Jetpack Panel API)
panel.show(anchor) DomElement
但是我想将面板放置在窗口的右下角-我该怎么做-在哪里可以找到有关它的更多文档.
But I'd like to position the panel in the bottom right corner of the window - How do I do this - and where can I find some more documentation about it.
推荐答案
我知道能够将面板定位到右下角的唯一方法是将图标(或文本,如下面的示例)放置在状态栏中.之后,可以将面板链接到图标上方.
The only way I'm aware of to be able to position a panel to bottom right requires an icon (or text, as in the example below) to be placed in the statusbar. After that the panel can be linked to be positioned above the icon.
模仿 Jetpack的JEP Wiki :
function openBottomRightPanel(anchor){
jetpack.panels.open({
url: "http://stackoverflow.com",
anchor: anchor,
align: "bottom right with anchor top right"
});
}
jetpack.statusBar.append({
html: "View SO",
onReady: function(widget) {
$(widget).click(function(){
openBottomRightPanel(widget);
});
},
});
单击状态栏文本时,将在浏览器窗口的右下角打开打开的窗口(Jetpack面板).(注:如果以编程方式打开面板,也许图标/文本可以为空白?)
When the statusbar text is clicked, the resulting window (Jetpack panel) shoud open in the bottom right corner of the browser window. (N.b. Maybe the icon/text can be blank, if the panel is opened programmatically?)
这篇关于使用定位面板在新的Jetpack API中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!