2011-10-19 50 views

回答

1

也可以通过创建面板并将其类型设置为“箭头”来完成此操作。实际上这是几乎相同的例子,他们对panel.type reference page

这里是如何做到这一点:

<panel id="testPanel" type="arrow"> 
    <vbox> 
     (... content goes here ...) 
    </vbox> 
</panel> 

那么你会打开它:

panel.openPopup(elementThatShouldTriggerIt, "before_start", 0, 0, false, false); 
MDN.Panel

更多信息

+0

非常整齐!谢谢。 – mattsven

3

它可能在Firefox/XUL中,它也被称为door-hanger popuphttps://developer.mozilla.org/en/JavaScript_code_modules/PopupNotifications.jsm#Notification_events http://scenari-platform.org/svn/dev-core/trunk/Lib_XulRunner/Darwin/modules/PopupNotifications.jsm

例如,下面的代码是弹出通知,超时功能,如果你不想让你可以删除超时功能。

超时功能的正常功能&如果用户点击浏览器上的任何位置,它将自动消失。

Components.utils.import('resource://app/modules/PopupNotifications.jsm'); 
var notify = new PopupNotifications(gBrowser, 
             document.getElementById("notification-popup"), 
             document.getElementById("notification-popup-box")); 

var notification = notify.show(
gBrowser.selectedBrowser, /*browser*/ 
"Extension-popup", /*id*/ 
"Hi, there!, I got a message for you!!",/*message*/ 
null, /* anchor ID */ 
/* mainAction */ 
{ 
      label: "Build PDE", 
      accessKey: "D", 

      callback: function() { 
         if(nodeSRC!=null) pde.emptyNodeSRC(nodeSRC); 

       window.openDialog("chrome://myextension/content/mypage.xul", "hello", "chrome,width=400,height=360",userContent, nodeSRC); 

      } 
     }, 
null, /* secondaryActions*/ 

{ blablal:'options'} 

); 

setTimeout(function(){ 
notification.remove(); 
}, 900);