Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 201517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:12:22+00:00 2026-05-11T17:12:22+00:00

I have a web page with an iframe in it (I don’t like it,

  • 0

I have a web page with an iframe in it (I don’t like it, but that’s the way it has to be). It’s not a cross-domain iframe so there’s nothing to worry about there.

I have written a jQuery extension that does the centering of a ModalPopup (which is called from an overridden AjaxControlToolkit.ModalPopupBehavior._layout method) based on the width and height of the iframe’s parent, so that it looks centered even though the iframe is not in the center of the page. It’s a lot of tricky stuff, especially since the web page I added the iframe to runs in quirks mode.

Now, I’ve also overridden AjaxControlToolkit.ModalPopupBehavior._attachPopup, so that when the parent window resizes or scrolls, the ModalPopup inside of the iframe recenter’s itself relative to the new size of the parent window. However, the same code that attaches the popup to the parent window’s resize event does NOT work for the parent window’s scroll event. See the code below, and the comments:

AjaxControlToolkit.ModalPopupBehavior.prototype._attachPopup = function() {
    /// <summary>
    /// Attach the event handlers for the popup to the PARENT window
    /// </summary>
    if (this._DropShadow && !this._dropShadowBehavior) {
        this._dropShadowBehavior = $create(AjaxControlToolkit.DropShadowBehavior, {}, null, null, this._popupElement);
    }
    if (this._dragHandleElement && !this._dragBehavior) {
        this._dragBehavior = $create(AjaxControlToolkit.FloatingBehavior, {"handle" : this._dragHandleElement}, null, null, this._foregroundElement);
    }        
    $addHandler(parent.window, 'resize', this._resizeHandler); // <== This WORKS
    $addHandler(parent.window, 'scroll', this._scrollHandler); // <== This DOES NOT work
    this._windowHandlersAttached = true;
}

Can anybody explain to me why the resize event works while the scroll event doesn’t? Any suggestions or alternatives out there to help me out? I am working with jQuery, so if I can use something besides the $addHandler method from MS that’d be fine. Be aware that I also have to override the _detachPopup function to remove the handler, so I need to take that into account.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:12:22+00:00Added an answer on May 11, 2026 at 5:12 pm

    Nevermind, quirks mode bit me again. Getting the scrollTop position from the parent was failing because it’s documentElement didn’t exist. I switched

    $(top.window.document.documentElement).scrollTop();
    

    to

    $(top.window.document.body).scrollTop();
    

    in my jQuery extension centering code and it’s happy now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a web site appear on an iphone with an iframe
I have some JavaScript code that dynamically injects an iframe in a given HTML
I need something like a cookie, but I specifically don't want it going back
I build new web site. On every post in my web site I have
I am creating a dynamic iframe. In order to listen for 'blur' even on
I have 2 master pages. One is intended to be shown in a normal
I'm working on a small project, it is a web harvester created in python
I've always wanted to know what is, in a general way, the opinions about
I need to get the complete output from an aspx site. When the user
I am new to Android development with Phonegap and just got through these two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.