YUI dialog/panel not rendering correctly in IE ifr

2019-07-31 23:33发布

问题:

I have built a few popups - some using YUI dialog, some using panel. These get rendered correctly in FF, Windows Safari, Chrome. Please refer following screenshots:

http://dl.dropbox.com/u/7681433/YUI%20Forum%20Screenhots/WorkingDialog-Firefox.PNG http://dl.dropbox.com/u/7681433/YUI%20Forum%20Screenhots/WorkingPanel-Firefox.PNG

However in IE 7, 9 & 10 the dialogs appear in a distorted manner sometimes and appear normally sometimes. See the screenshots below:

http://dl.dropbox.com/u/7681433/YUI%20Forum%20Screenhots/DistortedDialog-IE9.PNG http://dl.dropbox.com/u/7681433/YUI%20Forum%20Screenhots/DistortedPanel-IE9.PNG

I am not able to figure out what goes wrong only sometimes in IE. I am using YUI version 2.7.0.

To see this in action, you can access this blog page. Hover on one of the thumbnails and click on preview/download/transmit buttons.

http://embed-test-blog.blogspot.in/2012/04/sample-for-yui-forum.html

The blog url I provided above embeds the following url using an iframe.

http://embed.mediapartner.com/embed.aspx?e=f2+Wk9GtFDM=

I have noticed that if I directly access this url from IE, the dialogs appear to render alright! So I strongly feel that this is something to do with YUI dialogs being invoked within an iframe in IE. But I am not able to figure out how to overcome the problem. Any ideas?

Here is the code I am using for the preview dialog above - just in case that's of any help.

LargePreviewPopup =
{
popup: null,
    init: function()
    {
        this.popup = new YAHOO.widget.Panel("LargePreviewPopup",
        {
            width: "380px",
            height: "410px",
            zIndex: 3000,
            fixedcenter: true,
            visible: false,
            draggable: true,
            modal: true,
            constraintoviewport: false,
            effect: { effect: YAHOO.widget.ContainerEffect.FADE, duration: 0.10 }
        });
        if (YAHOO.env.ua.ie > 0)
            this.popup.cfg.setProperty("iframe", true);
        PluginFix.showHidePlugins(this.popup);
        this.popup.setHeader("NA");
        this.popup.setBody("NA");
        this.popup.render(document.body);
    },


onShowLargePreviewClick: function(userId, captionId, height, width)
    {
        if (!this.popup)
            this.init();
        this.popup.setBody("<div class='ajaxloader'></div>");
        this.popup.setHeader("Preview");

this.popup.hideEvent.subscribe(function()
        {
            LargePreviewPopup.popup.setBody("<div class='ajaxloader'></div>");
        });

this.popup.cfg.setProperty("height", height + 57 + "px");
        this.popup.cfg.setProperty("width", width + 35 + "px");
        this.popup.show();

var cObj = Custom.Ajax.asyncRequest('GET',
        '/embed/embed_operations.aspx?action=large_preview&amp;user_id=' + userId + '&amp;caption_id=' + captionId
            + '&amp;h=' + height + '&amp;w=' + width,
            {
                success: function(o)
                {
                    LargePreviewPopup.popup.setBody(o.responseText);
                }
            });
    }
};

回答1:

For anyone who might be facing this problem - I could not figure this out using YUI. So I implemented my pop-ups using jquery-ui on IE. So on all the non-IE browsers I use YUI pop-ups while for IE this is done using jquery-ui.