[CLOSED] Recenter modal window on page resize

  1. #1

    [CLOSED] Recenter modal window on page resize

    Is there a way to reposition modal windows when the page is resized back to the center? I'd like to do this globally for all windows.
    Last edited by Daniil; Aug 15, 2013 at 10:36 AM. Reason: [CLOSED]
  2. #2
    Hi @michaeld,

    I can suggest the following.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server">
                <Listeners>
                    <WindowResize Handler="var win = Ext.ComponentQuery.query('window[hidden=false][modal=true]');
                                           
                                           if (win.length > 0) {
                                               win[0].center();
                                           }" />
                </Listeners>
            </ext:ResourceManager>
    
            <ext:Window ID="Window1" runat="server" Title="Window 1" Modal="true" />
    
            <ext:Window ID="Window2" runat="server" Title="Window 2" Modal="true" Hidden="true" />
    
            <ext:Button runat="server" Text="Show 1" Handler="App.Window1.show();" />
    
            <ext:Button runat="server" Text="Show 2" Handler="App.Window2.show();" />
        </form>
    </body>
    </html>
  3. #3

    Thanks

    I'll try it.

Similar Threads

  1. Replies: 0
    Last Post: Jul 15, 2013, 8:34 AM
  2. Replies: 5
    Last Post: Apr 20, 2012, 6:20 AM
  3. Replies: 2
    Last Post: Feb 15, 2011, 8:24 PM
  4. Replies: 1
    Last Post: May 17, 2009, 6:06 PM
  5. Replies: 3
    Last Post: Feb 22, 2009, 2:58 PM

Posting Permissions