| | |
Accordion script
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 8
Reputation:
Solved Threads: 0
I have been working on a vertical accordion but seems not to be working, Can some one please check where the error is?
Thanks in advance;
At the Head
Event.observe(window, 'load', loadAccordions, false);
function loadAccordions() {
var verticalAccordions = $$('.accordion_toggle');
verticalAccordions.each(function(accordion) {
$(accordion.next(0)).setStyle({
height: '0px'
});
var Accordion = new accordion('vertical_container');
{
classNames : {
toggle : 'vertical_accordion_toggle',
toggleActive : 'vertical_accordion_toggle_active',
content : 'vertical_accordion_content',
}
});
defaultSize : {
height : null,
width : null
},
direction : 'vertical',
onEvent : 'click'
Accordion.activate($$('#vertical_content .accordion_toggle')[0]);
}
HTML
<div id="Content">
<table width="570px" cellpadding="2" cellspacing="5">
<tr>
<td>
<h2 class="accordion_toggle" align="left">......</h2>
<div class="accordion_content" align="justify">
............................................................
............................................................
</div>
</td>
</tr>
</div>
<script type="text/javascript" >
var verticalAccordions = $$('.accordion_toggle');
verticalAccordions.each(function(accordion) {
$(accordion.next(0)).setStyle({
height: '0px'
});
});
</script>
</body>
Is something wrong with the code or did I miss out sth?
Thanks in advance;
At the Head
Event.observe(window, 'load', loadAccordions, false);
function loadAccordions() {
var verticalAccordions = $$('.accordion_toggle');
verticalAccordions.each(function(accordion) {
$(accordion.next(0)).setStyle({
height: '0px'
});
var Accordion = new accordion('vertical_container');
{
classNames : {
toggle : 'vertical_accordion_toggle',
toggleActive : 'vertical_accordion_toggle_active',
content : 'vertical_accordion_content',
}
});
defaultSize : {
height : null,
width : null
},
direction : 'vertical',
onEvent : 'click'
Accordion.activate($$('#vertical_content .accordion_toggle')[0]);
}
HTML
<div id="Content">
<table width="570px" cellpadding="2" cellspacing="5">
<tr>
<td>
<h2 class="accordion_toggle" align="left">......</h2>
<div class="accordion_content" align="justify">
............................................................
............................................................
</div>
</td>
</tr>
</div>
<script type="text/javascript" >
var verticalAccordions = $$('.accordion_toggle');
verticalAccordions.each(function(accordion) {
$(accordion.next(0)).setStyle({
height: '0px'
});
});
</script>
</body>
Is something wrong with the code or did I miss out sth?
we learn everyday...knowledge is shared
are you writting this from scratch or using a framework?
you might want to take a look here: http://docs.mootools.net/Plugins/Accordion
you might want to take a look here: http://docs.mootools.net/Plugins/Accordion
![]() |
Similar Threads
- Expand/Callapse All Help! (JavaScript / DHTML / AJAX)
- Need help in javascript and modal window (JavaScript / DHTML / AJAX)
- Can't put 2 Javasript working in the same page! (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: document.getElementByTagName("a").href - will this work??
- Next Thread: Script works in IE, but not in Firefox
Views: 1599 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets array autoplay blackjack browser captchaformproblem checkbox child class close codes date debugger dependent developer disablefirebug dom editor element embed engine events explorer ext file firefox flash form forms game gears getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl maps margin marquee masterpage math matrixcaptcha media mysql object onerror onmouseoutdivproblem onreadystatechange parent passing paypal pdf php player position post programming rated redirect runtime safari scriptlets scroll search security session shopping size software solutions star stars stretch synchronous tweet unicode variables web webkit webservice window wysiwyg \n





