Script To Collapse A List
Jul 23, 2005
I have a list built on HTML and CSS:
<ul>
<li>Foo</li>
<li>Bar
<ul>
<li>Gee</li>
</ul>
</li>
</ul>
I need a script to expand and collapse items so only one sublist is visible
at a time. I've found several scripts for trees but they either need the
list to be in their own format or they add tons of weird code to insert
icons and style the list (which breaks my design). Could you recommend me a
simple script to do so?
View 4 Replies
ADVERTISEMENT
Jun 2, 2010
I have been trying to make an expand/collapse (essentially accordion) list. So far, everything works and looks fine in Firefox, Safari, and Chrome, but in IE8, the page height is static when it loads, with a page height being as if all headers in the list were expanded. The expand/collapse functionality works,but as you can imagine, there is this big gap of space after the list.
The html markup uses <h2> tags for the always-visible header portion and a <div> for the expanding/collapsing content. The <div> content contains form elements and everything is enclosed in a form tag.Anyways, here is the jQuery code:
$(document).ready(function() {
$('<img src="plus.png" class="icon" />').prependTo('.header');
$('.content').hide();[code].....
View 5 Replies
View Related
Feb 18, 2010
I've made a animated collapsable list using this script. But now I want to keep one submenu expanded, I have the ID of the ul that must be kept expanded. So after everything is collapsed my script checks the ID of every submenu and compares it to the given ID. If the ID of the submenu is equal to the given ID, the submenu should expand. Should, because that doesn't. Here's the code:
[Code]...
I've never used jQuery before, I tried this, but it doesn't work. Also, I don't want to toggle the children, but just show them; without an animation.
View 2 Replies
View Related
Apr 5, 2006
im using this toggle for a project, i have use it once, and it works well with IE, but then again, for mozilla, its not being displayed correctly after the first toggle, Code:
View 8 Replies
View Related
Jul 24, 2002
I am wondering how I would make the [-] Button that collapses/expands a thread here on the forums. (I hope you know what I mean, its tough to explain)
I am going to have a page with multiple entries using XML and would like to be able to have the title of an entry showing and then you can press on the expand button to view further details.
Can this be done with JavaScript or DHTML?
View 24 Replies
View Related
Feb 23, 2011
I have a bit of code that works perfectly for me that expands/collapses a div without any animation from top to bottom. I'm looking for the same exact code that lets me expand/collapse from left to right. I've done my due diligence and have search many forums with limited luck (I've only found one that is animated that I can't turn off the animation). Can someone point me in the right direction to code that does exactly the same as what I've posted below except from left to right?[code]
View 2 Replies
View Related
Jun 29, 2010
I have a php function that returns a list of people with their attributes ie address, telephone, email, etc. my idea is to display the full name of person, and then when I click on a link "more data" open a window down to display the other data, email, phone, etc.., for this use a jQuery script that collapses / expands a div, taken from: [URL], the script works fine, but only runs on the first element (person) that appears in the list in the other script is not running, if I have several pages of results, always work the first item on the list. this is the javascript code of the page, obviously this liibreria declared jquery:)
$ (Function () (
$ ("# Mmm.") Click (function (event) (
event.preventDefault ();
$ ("# Panel_menu"). SlideToggle ();
[Code].....
View 5 Replies
View Related
May 16, 2011
I have a drop down menu who shows a list of page. Some links have subcategories. When I click to it that show the subcategory list. But what I want is when I click on another that close the previous one. Just one should be open. You can have a look at the screenshot:
[Code]...
View 4 Replies
View Related
Jun 18, 2004
I'm running into a problem with having a bunch of different selected areas in my editable document in mozilla. I can't seem to get them all unselected. I can get one or two to unselect but not all of them.
This happens after I have been using comparePoint in a loop that loops through the whole document. I have used collapse on the selection I made but it leaves other text still selected. :confused: Is there a quick way to unselect all the selections in mozilla?
View 2 Replies
View Related
May 24, 2006
My intent is to be able to expand/collapse multiple tables individually, and all at once. My current implementation allows for the "individual", but not the "all at once" functionality, because the current code I'm using just toggles. code:
View 2 Replies
View Related
Feb 14, 2010
Where i can find a script for div collapse...i am looking for a script where div is collapsing from left to right side.
View 2 Replies
View Related
May 18, 2010
it's not expanding & collapsing for me. Here's what I have:
Head:
PHP Code:
<script language="JavaScript" type="text/JavaScript" src="js/collapse_expand_single_item.js"></script>
Body:
HTML Code:
<img src="img/u.gif" name="imgfirst" width="9" height="9" border="0" >
[Code]....
View 2 Replies
View Related
Feb 24, 2011
I'm not very experienced with javascript, but I have a bit of code that works perfectly for me that expands/collapses a div without any animation from top to bottom. I'm looking for the same exact code that lets me expand/collapse from left to right.I've done my due diligence and have search many forums with limited luck (I've only found one that is animated that I can't turn off the animation). Can someone point me in the right direction to code that does exactly the same as what I've posted below except from left to right?[code]
View 5 Replies
View Related
May 29, 2006
Im just starting to get into javascript, and what I am trying to do is
find a script that I can run on page load that will collapse / hide all
div tages that have an id that begins with "div_".
Basically I have a page with an infinite amount of div tags each having
their own id, ie div_0 , div_1 etc etc ..
on page load i want them all closed, but only these ones . not any
other div on the page .. how would I be able to do this ..
View 2 Replies
View Related
Jun 14, 2011
i want to collapse all level at load in this site : [URL]
View 1 Replies
View Related
Jun 12, 2009
I've got a series of nested tables with data that look someting like this. [code]...
View 3 Replies
View Related
Feb 15, 2010
I look for something in jquery ( a sliding panel div that can also be collapsed and shows the correct image, hard to explain please see below link, its used on this [code]Anything such exist for jquery with the same features?
View 1 Replies
View Related
Jan 20, 2009
Been looking for a way to do:
[URL]
BUT, without needing a framework (jquery,mootools,scriptalicious,protoype,dojo,etc). I don't need all the extras that come with the framework and want to keep loading time down to a minimum.
Everywhere online seems to need a framework.
View 3 Replies
View Related
Aug 11, 2007
I realize that expanding/collapsing DIV scripts are common but I can't find one suitable for my code. Most of them seem to rely on a unique DIV ID. I have the following XHTML code on my page.
Code:
<div id="container">
<h1>List of Events Happening:</h1>
<div class="event">
<div class="eventtitle">
<h1>Event 1</h1>
<p><a href="#">[ expand++ ]</a></p>
</div>
<div class="eventbody">
<!-- stuff -->
</div>
</div>
<div class="event">
<div class="eventtitle">
<h1>Event 2</h1>
<p><a href="#">[ expand++ ]</a></p>
</div>
<div class="eventbody">
<!-- stuff -->
</div>
</div>
<div class="event">
<div class="eventtitle">
<h1>Event 3</h1>
<p><a href="#">[ expand++ ]</a></p>
</div>
<div class="eventbody">
<!-- stuff -->
</div>
</div>
<!-- etc. -->
Basically I want my link to expand the .eventbody for the particular .event and there could be an unlimited number of .events. I'm not sure how to go about achieving this. I've already got a script that toggles the display(block or none) for a DIV, but it relies on a specific DIV ID.
View 8 Replies
View Related
Oct 20, 2005
I have bit of PHP that creates tables on the fly. I found a bit of javascript that works on static tables, but not very well with 'on the fly' tables. It works to the point where the expand/collapse link works on only the first table on the page. For example, 4 tables will be created when the page compiles. If I try to use the expand collapse thing on table 4, it will only affect the first table.. same with the second and third tables.
Is there a way to make all this code dynamic? Maybe make the ID dynamic or a different way other than document.getElementById? Code:
View 5 Replies
View Related
Jan 18, 2011
I want to add a + - for collapse and expand all. I would prefer to have them change accordingly but it isn't necessary.
This is my javascript:
var toggleMenu = {
init : function(sContainerClass, sHiddenClass) {
if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
var arrMenus = this.getElementsByClassName(document, 'ul', sContainerClass);
var arrSubMenus, oSubMenu, oLink;
for (var i = 0; i < arrMenus.length; i++) {
arrSubMenus = arrMenus[i].getElementsByTagName('ul');
for (var j = 0; j < arrSubMenus.length; j++) {
oSubMenu = arrSubMenus[j]; .....
This is my html code:
<script type="text/javascript">
function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v=='hide')?'hidden':v; }
obj.visibility=v; }
}
</script> .....
View 9 Replies
View Related
Apr 3, 2010
I want to make a menu. I did google for it. [URL]
but its too simple.
This is what I need to do.
Tab 1
Tab 2
Tab 3
By default tab 1 should be open. when I click on tab 2, tab 1 should collapse and tab 2 should expand.
View 2 Replies
View Related
Jun 21, 2007
I have a javascript to expand and collapse content in 3 ways (all items, one item and nothing).
I have written a javascript myself but the iconcs that are used to switch between modes don't show correctly in IE7, not always then. Here's how it should work:
Default expand one, expand all, expand nothing is loaded from a cookie. If not available, expand all will be executed.
If you click on an icon an event goes which does 3 things: changes the event of the image in the browser (so open_all becomes open_one, this is how I make it switch).adds style="display: none;" to the other element and makes this one visible.saves the new state to a cookie. Code:
View 3 Replies
View Related
Sep 10, 2002
I have some server-side code that creates a table from a database query. The basic idea is that there are group leaders and each leader has one or more members. I created the ID dynamically from the query.
When a user clicks the button next to a group leader, the members should hide or show, opposite of current display. Code:
View 5 Replies
View Related
May 26, 2010
how to store the status of a expand and collapse?
View 4 Replies
View Related
Oct 11, 2011
I started some programming with Javascript.I'd like to use it to expand/collapse some headers in a page. I made following code to do this.:collapse-expand.txt.That works perfect!But I want to add something, and I have some problems with that. As I have e.g. 4 headers, I want to expand the text (in <p>-tag) by clicking on header 1. When I click on header 2, I want to collapse text of header 1 and expand header 2 text.And so on.That way, I get the height of the site relatively small without needing to scroll.I don't quite know how to implement this function into my JS-code!And if it could be implemented in my .js file, how do I link that in my html, because now I have in every header the same line:<a href="#first" onClick="shoh('first');">, <a href="#second" onClick="shoh('first');">, etc..How can I get the content of header 1 be seen as soon as the screen pops up. So you don't have to click on Header1 before you can see it? And then go on from there: clicking on header2 makes text of header 1 disappear and expands text from header 2, and so on.
View 24 Replies
View Related