-
Feb 28th, 2013, 06:48 PM
#1
Thread Starter
PowerPoster
Making an Accordion Control?
I'm using JQuery to create an Accordion control. The problem that I'm having is that when I run my webapp, 1 section of the Accordion control is open. I have a total of 4 sections (<div>'s) but everytime I run it, the 1st <div> is always open. I'm using it as a Sidebar menu control and want all the sections to be closed by default. How can this be done?
Thanks,
-
Mar 1st, 2013, 04:58 AM
#2
Re: Making an Accordion Control?
hmm... without seeing the code or a demo of it, I won't be able to say any solutions. I believe, others would also be like me.
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Mar 3rd, 2013, 05:14 PM
#3
Re: Making an Accordion Control?
Are you using a third-party jQuery plugin for this (eg. jQuery UI Accordion)? Any chance of putting an test/example up on http://jsfiddle.net/?
-
Mar 3rd, 2013, 05:54 PM
#4
Thread Starter
PowerPoster
Re: Making an Accordion Control?
I'll see what I can do...
-
Feb 5th, 2020, 11:26 PM
#5
Member
Re: Making an Accordion Control?
You try this query of making an accordian:
Code:
<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.display === "block") {
panel.style.display = "none";
} else {
panel.style.display = "block";
}
});
}
</script>
< advertising removed by moderator >
-
Feb 5th, 2020, 11:28 PM
#6
Member
Re: Making an Accordion Control?
You try this query of making an accordian:
Code:
<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.display === "block") {
panel.style.display = "none";
} else {
panel.style.display = "block";
}
});
}
</script>
< advertising removed by moderator >
-
Feb 7th, 2020, 03:04 PM
#7
Thread Starter
PowerPoster
Re: Making an Accordion Control?
tr333...I used the example from the link you provided and made modifications! Works great! Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|