?
Solved

TreeView not working inside accordion menu

Posted on 2013-02-04
2
Medium Priority
?
962 Views
Last Modified: 2013-02-05
I have to create a menu with accordion and tree view.
But the problem i am facing is the tree view is not working in accordion menu

Please help me to resolve the problem.

Code is given below

<head>
  <meta charset="utf-8" />
  <title>jQuery UI Accordion - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
  <script type="text/javascript"
     src="${pageContext.request.contextPath}/resources/js/treeview/jquery.cookie.js"></script>
<script type="text/javascript"
   src="${pageContext.request.contextPath}/resources/js/treeview/jquery.treeview.js"></script>
 
 
<link rel="stylesheet"
      href="${pageContext.request.contextPath}/resources/css/jquery.treeview.css" />
 
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
  $("#black, #gray").treeview({
            control : "#treecontrol",
            persist : "cookie",
            cookieId : "treeview-black"
      });
 
  $(function() {
          $( "#accordion" ).accordion();
        });
       
  </script>
</head>
<body>
 
<div id="accordion">
  <h3>Heading</h3>
        <div>
         <ul id="black" class="treeview-black">
                              <ul>
                                    <li><span>Leve1</span>
                                          <ul>
                                                <li>Level2</li>
                                          </ul>
                                    </li>
                              </ul>
                        </ul>
     
        </div>
  <h3>Purchase</h3>
  <div>
    <p>
    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
    purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
    velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
    suscipit faucibus urna.
    </p>
  </div>
 
</div>
 
</body>
</html>
0
Comment
Question by:Rocking
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 7

Accepted Solution

by:
Element1910 earned 2000 total points
ID: 38852000
Got it working for me by putting that jquery.treeview in it's own folder (directly from download), into the Scripts directory on my site directory, then changing the relative paths to the css/jquery. See page source below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Accordion - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
  <script src="Scripts/jquery.treeview/jquery.treeview.js" type="text/javascript"></script>
    <script src="Scripts/jquery.treeview/lib/jquery.cookie.js" type="text/javascript"></script>
  <link href="Scripts/jquery.treeview/jquery.treeview.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery.treeview/demo/demo.js" type="text/javascript"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script type="text/javascript">
      // fourth example
      $("#black, #gray").treeview({
          control: "#treecontrol",
          persist: "cookie",
          cookieId: "treeview-black"
      });

      $(document).ready(function () {
          $(function () {
              $("#accordion").accordion();
          });

      });
       
  </script>
</head>
<body>
 
<div id="accordion">
  <h3>Heading</h3>
        <div>
         <ul id="black" class="treeview-black">
                              <ul>
                                    <li><span>Leve1</span>
                                          <ul>
                                                <li>Level2</li>
                                          </ul>
                                    </li>
                              </ul>
                        </ul>
     
        </div>
  <h3>Purchase</h3>
  <div>
    <p>
    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
    purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
    velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
    suscipit faucibus urna.
    </p>
  </div>
 
</div>
</body>
</html>

Open in new window

0
 
LVL 7

Expert Comment

by:Element1910
ID: 38852009
And here's a image of what it looks like (see attached).
AccordianTreeview.JPG
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question