Is it possible to expand all components when page is load or when an event occurs? Thanks!!
A:
You can do it in the document.ready
event jQuery provides, like this:
CSS:
.myClassToBeHidden { display: none; }
jQuery:
$(function() {
$(".myClassToBeHidden").slideDown();
});
If you mean with the accordion control from jQuery UI then...you shouldn't use accordion, expanding all isn't what it's for and they advise against this as it causes other issues.
Nick Craver
2010-04-01 06:36:02
@durilai - Not sure what they're asking based on the question, was just adding some more info around each.
Nick Craver
2010-04-01 06:39:56
@Nick - agree. I saw your update and removed comment.
Dustin Laine
2010-04-01 06:43:26
+1
A:
No, if you are referring to accordion as your tag states. From jQuery.
NOTE: If you want multiple sections open at once, don't use an accordion
Dustin Laine
2010-04-01 06:37:02
A:
To make it unobtrusive and be hidden only if the visitor has javascript I'd put
CSS:
#divToBeHidden { display: block; }
In <head>
:
$('#divToBeHidden').hide();
Bottom of <body>
:
$(function() {
$("#divToBeHidden").show(); //Or whatever means you'd prefer of showing the content
});
David Andersson
2010-04-01 06:41:12
@elcherino: I don't know if I correctly understood your question, please evolve further what you'd like to do.
David Andersson
2010-04-01 06:42:50
@David - You can place a `$(function() { });` function wherever you like...it won't run until the document's ready and won't block the page in either case :)
Nick Craver
2010-04-01 06:49:39
@Nick Craver: Oh yeah, of course, you're right. Thanks. It's just me that likes to keep all run-time stuff in the bottom. :)
David Andersson
2010-04-01 07:15:00
@David: My problem is: I have a js. My js search text into my page. But my script doesn't find text (even if is present) into hidden div.So, my idea is: when the user write a string in my input type text automatically I expand all divs so my search script run and user finds the text.Sorry for my bad english :-)
2010-04-01 10:21:17