简体   繁体   中英

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.
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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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