I've managed to create 2 buttons labeled SHOW & HIDE, along with a DIV
containing some content. My goal is for the first button to expand the width of the content DIV
upon clicking, hiding itself in the process and revealing the second button simultaneously.
Conversely, when the second button is clicked, the content DIV
should collapse its width, hiding the second button and bringing back the first button. However, I'm encountering an issue with this functionality. Can someone help me out?
$(document).ready(function(){
$("#seeall2").hide();
$("#seeall").bind("click",
function(){
$("#speakers").animate({width: 880}, 1500);
$("#seeall").hide(500);
$("#seeall2").show(500);
});
$("#seeall2").bind("click",
function(){
$("#speakers").animate({width: 410}, 1500);
$("#seeall").show(500);
$("#seeall2").hide(500);
});
});
This is my HTML :
<div id="speakers">
<a href="" id="seeall">EXPAND</a>
<a href="" id="seeall2">COLLAPSE</a>
<div id="pics-wrap">
content...
</div>
</div>
PLEASE SEE THIS http://jsfiddle.net/ajinkyax/mSjbV/ ITS WORKING NOW. SOLUTION : I removed extra space from SCRIPT tag