在新的Jetpack API中使用定位“面板” [英] Using positioning 'Panel' in new Jetpack API

查看:144
本文介绍了在新的Jetpack API中使用定位“面板”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在使用新版本的Jetpack API,它允许您使用JS框架为Firefox创建插件。

'panel'对象是易于使用 - 但我正在努力找到一种方法来定位它。文档只是说明( Jetpack Panel API

  panel.show(anchor)DomElement 

但是我想将窗格放置在窗口的右下角 -
我该如何操作?我在哪里可以找到更多关于它的文档。

解决方案

,如下面的例子)被放置在状态栏中。之后,面板可以链接到位于图标上方。



模仿 Jetpack的JEP wiki

 函数openBottomRightPanel(anchor){
jetpack.panels.open({
url:http://stackoverflow.com,
主播:主播,
对齐:右下角与主播右上角
});


jetpack.statusBar.append({
html:View SO,
onReady:function(widget){
$(widget) .click(function(){
openBottomRightPanel(widget);
});
},
});

单击状态栏文本时,窗口(Jetpack面板)将在右下角打开的浏览器窗口。 (N.b.也许图标/文本可以是空白的,如果面板以编程方式打开?)

I'm now using the new version of the Jetpack API of which allows you to create addons for Firefox using a JS framework.

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.

Mimicking Jetpack's 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);
    });
  },
});

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆