PDA

View Full Version : jQuery TreeView menu problem, expands first node on when loading page



Windwill
09-03-2009, 08:02 AM
1) Script Title: jQuery TreeView menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/treeview/index.htm

3) Describe problem: I just installed the Jquery treeview menu on my site. It's working fine, doing what It should, but for some reason it expands the first node, expanding the entire level, just to collapse back and then it goes to the menuheading I've clicked.

Very annoying. I've tried different settings, but with no luck. It does the same with all levels and sublevels. This is my first try with jquery and I'm not really sure of what I'm doing. This is the functions I'm using. I've tried using the cookie function, but it just makes the whole menu expand.


$(document).ready(function(){
$("#treemenu1").treeview({
collapsed: true,
animated: "medium",
unique: false,
persist: "location"

});
})

I'm using this in quite an awkward way, trying to implement it in to a joomla-module which had a expandable menu that didn't work at all for me. But it works except for the node expanding. Here's the html/php that renders the menu. I really suck at php so I'm not sure the if the problem is here or in the jquery or the css.


<?php if (count($list)) : ?>
<ul id="treemenu1" class="filetree">
<?php foreach ($list as $root_category) : ?>
<li>
<a href="<?php echo $root_category->link; ?>">
<?php echo $root_category->text;?> <?php echo $root_category->count; ?>
</a>
<ul>
<?php foreach($root_category->subcats as $category) : ?>
<li>
<a href="<?php echo $category->link; ?>">
<?php echo $category->text;?> <?php echo $category->count; ?>
</a>
<?php $this->getDisplayableDefault($category->subcats); ?>
</li>
<?php if ($this->is_combine_on()) : ?>
<?php foreach($category->articles as $article) : ?>
<li>
<a href="<?php echo $article->link; ?>">
<?php echo $article->text;?>
</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>

</ul>
</li>
<?php if ($this->is_combine_on()) : ?>
<?php foreach ($root_category->articles as $root_article) : ?>
<li>
<a href="<?php echo $root_article->link; ?>">
<?php echo $root_article->text;?>
</a>
</li>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</ul>

Can anyone help me?