MVC5 Classic
Set Expand On Hover

The wijtree widget allows you to set its options so the nodes will expand when a user hovers over them with the mouse. See the Expand on Hover > Tree sample of the MVC Control Explorer live demos at http://demo.componentone.com/ASPNET/MVCExplorer/tree/ExpandonHover.

  1. Create an C1 ASP.NET MVC 5 Web Application.
  2. In the Solution Explorer, expand the Views | Shared folder and double-click _Layout.cshtml to open the file.
  3. Add the following markup within the <body> tags of the page.
    <div>
            <ul id="tree">
                <li class="folder"><a><span>Folder 1</span></a>
                    <ul>
                        <li class="folder"><a><span>Folder 1.1</span></a>
                            <ul>
                                <li class="file"><a><span>File 1.1</span></a></li>
                                <li class="file"><a><span>File 1.2</span></a></li>
                                <li class="file"><a><span>File 1.3</span></a></li>
                                <li class="file"><a><span>File 1.4</span></a></li>
                                <li class="file"><a><span>File 1.5</span></a></li>
                            </ul>
                        </li>
                        <li class="file"><a><span>File 1.2</span></a></li>
                        <li class="file"><a><span>File 1.3</span></a></li>
                        <li class="file"><a><span>File 1.4</span></a></li>
                        <li class="file"><a><span>File 1.5</span></a></li>
                    </ul>
                </li>
                <li class="folder"><a><span>Folder 2</span></a>
                    <ul>
                        <li class="file"><a><span>File 2.1</span></a></li>
                        <li class="file"><a><span>File 2.2</span></a></li>
                        <li class="file"><a><span>File 2.3</span></a></li>
                        <li class="file"><a><span>File 2.4</span></a></li>
                        <li class="file"><a><span>File 2.5</span></a></li>
                    </ul>
                </li>
                <li class="folder"><a><span>Folder 3</span></a>
                    <ul>
                        <li class="file"><a><span>File 3.1</span></a></li>
                        <li class="file"><a><span>File 3.2</span></a></li>
                        <li class="file"><a><span>File 3.3</span></a></li>
                        <li class="file"><a><span>File 3.4</span></a></li>
                        <li class="file"><a><span>File 3.5</span></a></li>
                    </ul>
                </li>
            </ul>
        </div>
    
  4. Use the following script to initialize the widget:
    <script id="scriptInit" type="text/javascript">
         $(document).ready(function () {
             var tv = $("#tree").wijtree({
                 expandCollapseHoverUsed: true,
                 expandAnimation: {},
                 collapseAnimation: {}
             });
         });      
        </script>
    
  5. Run the project. When you hover over one of the nodes, it should open:

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback