Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

TreeView not working inside accordion menu

Posted on 2013-02-04
2
Medium Priority
?
978 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
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…
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

636 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