I want to change header, text, youtube video and picture for every time I click one of the links. The page is not supposed to change, just the text and media in the boxes I 'drew' in the example below:
|Link 1 |.....................| Header......................|
|Link 2 |.....................| Paragraph text..........|
|Link 3 |.....................|_________________|
|Link 4 |.....................|.....................|.............|
|Link 5 |.....................| Youtube vid | Picture |
|Link 6 |.....................|.....................|.............|
First of all Header/Paragraph box, the youtube vid and the picture should begin with having the text and media which also is supposed to appear if you pressed Link 1. Then, every time you press another Link, the text and media will just fade out and new text and media will fade in.
Like if you click Link 2, some text will dissapear and new will appear, same goes for the media.
I'd like to use jQuery/JavaScript to do this!
Please help me!!
HTML:
<ul id="entireList">
<li class="singleList">
<a class="link" href="#" id="link1">
Link 1
/a>
</li>
<li> /* the same for all of the 6 links, different id and text ofc */
...
</ul>
The boxes:
<div class="text">
</div>
<div class="media">
</div>
Javascript/jQuery:
var h1 = 'Header text for link 1'
var p1 = 'Paragraph text for link 1' /* I'll make one for each link */
$(function() {
$('div.text').show().html(h1 + p1); /* Shows the text from Link 1 asap */
$('a.link #link1').click(function() { /* When click on link, text will change */
$('div.text').html(h1 + p1);
});
});
NOTHING works