jQWidgets Forums

jQuery UI Widgets Forums Dialogs and Notifications Window Get the Window's current location

This topic contains 2 replies, has 2 voices, and was last updated by  BrentH 10 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Get the Window's current location #60395

    BrentH
    Participant

    How do I get the window’s current location (top and left or otherwise)?

    Thanks

    Get the Window's current location #60412

    Nadezhda
    Participant

    Hello BrentH,

    Please, find below an example which shows how to get position of the window:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en">
    <head>
        <title></title>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.summer.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxwindow.js"></script>
        <script type="text/javascript" src="../ver3.5.0/jqwidgets/jqxbuttons.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#jqxwindow").jqxWindow({ height: 90, width: 150, theme: 'summer' });
                $("#btn").jqxButton({ theme: 'summer' });
                $("#btn").on('click', function () {
                    var p = $("#jqxwindow");
                    var offset = p.offset();
                   alert("left: " + offset.left + ", top: " + offset.top);
                });
            });
        </script>
    </head>
    <body>
        <div id='content'>
            <div id='jqxwindow'>
                <div>Header</div>
                <div>Content</div>
            </div>
            <input type="button" id="btn" value="Get position" />
        </div>
    </body>
    </html>

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/

    Get the Window's current location #60473

    BrentH
    Participant

    Thanks, that works great.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.