javascript - show/hide mulptiple divs using jquery -
im new jquery , understand of hitting me hard. ive looked around answer maybe im trying specific.
this jquery code im using :
$(document).ready(function(){ $(".slidingdiv").hide(); //hides div $(".show_hide").show(); //click on img show hidden div $('.show_hide').click(function(){ $(".slidingdiv").slidetoggle("slow"); }); heres example of html : <div class"> <img height="300" width="350" src="images/web.png" alt="design 1" class=" show_hide img-responsive center-block wow fadein" href="#"/> <br> </div> when click image , toggles hidden div : <div class="slidingdiv"> <div> <img height="300" width="350" src="images/web.png" alt="design 1" class="img-responsive center-block" /> </div> </div> css: .slidingdiv{ height:400px; background-color:black; padding:50px; margin-top:10px; margin-bottom: 35px; border-bottom:1px solid #3399ff; } .show_hide{ display:none; }
and works awesome when add "show_hide" class image want use , div appears nicely above when add class "slidingdiv" , how implement more 1 image different divs jquery?
i registered today @ stack sory if im doing somethings wrong.
here how can do,
$(document).ready(function(){ $(".slidingdiv").hide(); //hides div $(".show_hide").click(function(){ $(".slidingdiv").show("slow"); }); });
if want make multiple div appear , disappear when click on single image can add class slidingdiv
div
<div class="slidingdiv"> text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text </div> <div class="slidingdiv"> text text text text text text text text text text text text text text </div> <div class="slidingdiv"> text text text text text text text text text text text text text text </div>
Comments
Post a Comment