Open In App

jQWidgets jqxDocking addWindow() Method

jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxDocking is used for representing a widget to manage multiple windows and also the layout of a web page. 

Each window in the specified jqxDocking can do multiple tasks such as it can be dragged around the web page, docked into docking zones, removed from the docking, collapsed into a minimized state for hiding its content, and also can be expanded for displaying its content.

The addWindow() method is used for adding a new window to the specified jqxDocking.

Syntax:

$('#jqxDocking').jqxDocking('addWindow', 
       'windowId', 'mode', panel, position);

 

Parameters: This method accepts four parameters that are illustrated below.

Return values: This method does not return any values.

Linked Files: Download jQWidgets from the given link. In the HTML file, locate the script files in the downloaded folder.

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdocking.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxwindow.js”></script>

Example: The below example illustrates the jQWidgets jqxDocking addWindow() method. In the below example, a new window of id “Second_Window” has been added.




<!DOCTYPE html>
<html lang="en">
  
<head>
    <link rel="stylesheet" 
          href="jqwidgets/styles/jqx.base.css" 
          type="text/css"/>
    <script type="text/javascript" 
            src="scripts/jquery.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxcore.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxdocking.js">
    </script>
    <script type="text/javascript" 
            src="jqwidgets/jqxwindow.js">
    </script>
</head>
<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
        <h3>
            jQWidgets jqxDocking addWindow() Method
        </h3>
        <div id="jqx_Docking" style="margin:25px;" 
             align="left">
            <div>
                <div id="First_Window">
                    <div>First Window</div>
                    <div>
                        <h8>Content for the first window</h8>
                        <ul>
                            <li>GFG</li>
                            <li>CSE</li>
                        </ul>
                    </div>
                </div>
                <div id="Second_Window">
                    <div> Second Window</div>
                    <div>
                        <h8>Content for the second window</h8>
                        <ul>
                            <li>GeeksforGeeks</li>
                            <li>CSE</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#jqx_Docking").jqxDocking({
                    width: 250
                });
                $('#jqx_Docking').jqxDocking(
              'addWindow', 'Second_Window', 'floating', 1, 0);
            });
        </script>
    </center>
</body>
</html>

Output:          

Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxnavigationbar/jquery-navigationbar-api.htm?search=


Article Tags :