简体   繁体   English

如何通过转换在 xul 中打开弹出窗口

[英]How to open popup in xul with transition


I have a panel that opens when the user clicks the toolbar button,In order to open it I am using the openPopup method.我有一个面板,当用户单击工具栏按钮时打开它,为了打开它,我正在使用 openPopup 方法。
I want to openPopup with some effects,I don`t know - fade in,fade out,easing,how can I do this?我想用一些效果打开弹出窗口,我不知道 - 淡入、淡出、缓动,我该怎么做?

You can change panel opacity as you like.您可以根据需要更改面板不透明度。 Some code to indicate how that might work (untested):一些代码表明它可能如何工作(未经测试):

var panel = ...;
fadeIn(panel);
panel.openPopup(...);

function fadeIn(element)
{
  var step = -1;
  var maxStep = 10;
  function doStep()
  {
    step++;
    element.style.opacity = step / maxStep;
    if (step < maxStep)
      setTimeout(doStep, 100);
  }
  doStep();
}

There is an issue however: panel transparency isn't supported for all Linux distributions.但是有一个问题:并非所有 Linux 发行版都支持面板透明度。 For some distributions you will get a black rectangle instead of the panel if opacity is less than 1. Windows and OS X work correctly however.对于某些发行版,如果不透明度小于 1,您将获得黑色矩形而不是面板。但是 Windows 和 OS X 可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM