I ran into the problem of creating some Toggle effect with jQuery between two divs. I am very bad at jQuery. and with the knowledge that I could not do to switch between two divs.
Current code in JS script: http://jsfiddle.net/WSCBu/
I have three sections. Class name Blue, gray and orange. What I'm trying to do is: when the page loads only two divs Blue and gray will show, and when I click Text "Show" on the gray div, the gray div will show Hide and Orange Div. and when I click "Hide" the text in the orange div, that orange div will be hidden and display the gray div again. Maybe this can be done using the switch function? I really don't know how to do this. Hope for experts is easy! I will be very grateful if someone will show me this process.
here is HTML
<div class="blue"></div> <div class="gray"> <p> Show --> </p> </div> <div class="orange"> <p> -- Hide </p> </div>
Css
.blue{ height:100px; width:250px; background:#1ecae3; float:left; } .gray{ height:100px; width:100px; background:#eee; float:left; } .orange{ height:100px; width:150px; background:#fdcb05; float:left; }
source share