I got 3 sections and would like to show them one by one by using jQuery and I don’t know how?
JQUERY
$infos = $(“#ex-2”).find(‘section’).hide(),
HTML
<div class="ex">
<article>
<section>
<font style="background-color:#000000"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </font>
</section>
<section>
<font style="background-color:#000000"> testing testing </font>
</section>
<section>
<font style="background-color:#000000">testing 2</font>
</section>
</article>
</div>
Any help?
Well first up your container div has a class, not an id, so you need to select with
".ex"not"#ex-2". Then try something like this:Demo: http://jsfiddle.net/A2Nbu/
If “show them one by one” means show one, then hide it and show the next, and keep going indefinitely, then a minor modification to the above will do that:
Demo: http://jsfiddle.net/A2Nbu/2/
Either way the idea is to start with the sections hidden, and cycle through them one by one using an index variable
i.Details about the jQuery methods I’ve used are available at the jQuery API reference site.