Re-center Modal Popup with Javascript

后端 未结 3 685
旧巷少年郎
旧巷少年郎 2021-01-01 01:22

I have a modal popup that initially shows some content but expands a div if a checkbox is selected. The modal expands correctly but doesn\'t recenter unless you scroll up or

相关标签:
3条回答
  • 2021-01-01 02:07

    Be careful that this isn't tied to the resize event of the window. If it is, your recentering could trigger a resize event in IE, which would cause an infinte loop.

    If it is tied to the resize event, allow 1 or 2 resize events to occur, but then ignore the rest. (I say 2, because in IE, a "restore" event on the window will trigger at least 2 resize events (3 in IE6).

    0 讨论(0)
  • 2021-01-01 02:21

    Whatever event you have bound to the scrolling to get it to re-center, bind that event to the checkbox/div expanding event as well (or call it from within the other event). Hard to say more without seeing some code.

    0 讨论(0)
  • 2021-01-01 02:26

    Here is what it is:

    $find('ModalPopupExtenderClientID')._layout();
    

    For example:

    $find('detailsPopUpExtenderId')._layout();
    

    and in aspx:

    <ccl:ModalPopupExtender runat="server" ID="MyPopUpExtender" TargetControlID="pop" PopupControlID="PopUp" BehaviorID="detailsPopUpExtenderId" BackgroundCssClass="ModalBackground" />
    

    BehaviorID being the property where to set the clientside id.

    0 讨论(0)
提交回复
热议问题