grfxdznr
10-29-2012, 11:47 PM
I have a page that has a button associated with each of the divs for the links to the items. I need to also place a link to a video in the page and need help making the function change the video image in the video div to correspond with the text in the text div at the same time. I have the text switching out just fine, but I could really use some help with getting both to change at the same time. BTW, this is not homework.
I would appreciate any help I can get with this!
$(document).ready(function(){
$('a').click(function () {
var divname= this.name;
$("#"+divname).show("fast").siblings().hide("fast");
});
});
</script>
<div id="content">
<div id="video"><img src="images/video.png" alt="Video" /></div>
<div id="buttons">
<div class="button1">
<a href="#" name="div1">button1</a>
<div class="button2">
<a href="#" name="div2">button2</a>
<div class="button3">
<a href="#" name="div3">button3</a>
<div class="button4">
<a href="#" name="div4">button4</a>
</div></div></div></div></div>
<div id="text">
<div id="div1" style="display:none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div id="div2" style="display:none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div id="div3" style="display:none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div id="div4" style="display:none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
</div>
</div>
</body>
</html>
I would appreciate any help I can get with this!
$(document).ready(function(){
$('a').click(function () {
var divname= this.name;
$("#"+divname).show("fast").siblings().hide("fast");
});
});
</script>
<div id="content">
<div id="video"><img src="images/video.png" alt="Video" /></div>
<div id="buttons">
<div class="button1">
<a href="#" name="div1">button1</a>
<div class="button2">
<a href="#" name="div2">button2</a>
<div class="button3">
<a href="#" name="div3">button3</a>
<div class="button4">
<a href="#" name="div4">button4</a>
</div></div></div></div></div>
<div id="text">
<div id="div1" style="display:none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div id="div2" style="display:none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div id="div3" style="display:none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
<div id="div4" style="display:none">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
</div>
</div>
</body>
</html>