dsp77 Posted October 10, 2011 Share Posted October 10, 2011 hello, i have a gallery that shows the hidden div after click, the problem is that i have around 20 pictures and i'm not able to hide the selected picture after the user selects other and so on. here is the piece of the code: $('.id2').one("click",function() { $('#test').css('display','block'); }); $('.id3').one("click",function() { $('#test3').css('display','block'); }); and the html <div id="big_photo"> <div id="test" style="display:none;"> <img src="images/team/team1.jpg" rel="images/team/team11.jpg" /> <p>Name</p> <span>title</span> </div> <div id="test3" style="display:none;"> <img src="images/team/team2.jpg" rel="images/echipa/team22.jpg" /> <p>Name2</p> <span>title2</span> </div> </div> and so on. Quote Link to comment https://forums.phpfreaks.com/topic/248788-jquery-css-dillema/ Share on other sites More sharing options...
dsp77 Posted October 10, 2011 Author Share Posted October 10, 2011 i managed to do a code for all pictures but i still cannot make them disappear after clicking other picture $('#echipa_left a').click(function (e) { e.preventDefault(); $('#echipa_' + this.id).css('display','block'); }); Quote Link to comment https://forums.phpfreaks.com/topic/248788-jquery-css-dillema/#findComment-1277665 Share on other sites More sharing options...
trq Posted October 10, 2011 Share Posted October 10, 2011 If you give all your divs the same class you can hide them all, then show the one you clicked on. Quote Link to comment https://forums.phpfreaks.com/topic/248788-jquery-css-dillema/#findComment-1277668 Share on other sites More sharing options...
dsp77 Posted October 10, 2011 Author Share Posted October 10, 2011 that's funny, so easy that i didn't think about it. Thanks Man Quote Link to comment https://forums.phpfreaks.com/topic/248788-jquery-css-dillema/#findComment-1277670 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.