3.0 beta 2

popup state

is there a way to find out whether a popup template is currently showing or hiding. I've tried
typeof(obj.getPopupTemplate().$popup) =="undefined"?"hidden":"visible"
but no cigar.
Dmitry
January 4,
I have never used this template but looking at your code I would have guessed it wouldn't work. Try this:
obj.getPopupTemplate().getStyle("visibility");


or

obj.getPopupTemplate().getStyle("display")


one of these might reveal hidden vs visible. The Display property is either empty (visible) or "none" (hidden)
Jim Hunter
January 4,
Jim, your code woulnd't work either. Here's how the popup template is implemented:

AW.Templates.Popup = AW.System.Template.subclass();

AW.Templates.Popup.create = function(){

    var obj = this.prototype;

    obj.setClass("popup", "normal");

    obj.showPopup = function(){

        var popup = window.createPopup();
        this.$popup = popup;

        var doc = popup.document;
        doc.open();

        AW.register(doc.parentWindow);

        if (AW.strict){
            doc.write("<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01\/\/EN\" \"http:\/\/www.w3.org/TR/html4/strict.dtd\">");
        }

        var cls = document.getElementsByTagName("html")[0].className;

        doc.write("<html class=\"aw-popup-window aw-system-control " + cls + "\"><head>");

        for (var i=0; i<document.styleSheets.length; i++){
            doc.write(document.styleSheets[i].owningElement.outerHTML);
        }
                          // [...]
Dmitry
January 8,
d'oh! i just answered my own question. The code should be:

typeof(obj.$popup) =="undefined"?"hidden":"visible"


thanks for the spark :)
Dmitry
January 8,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.