I am trying to write a script that will hide / show div depending on the visibility of other elements. The action should be performed when I click on another item. Here is what I have written so far:
$('#column-left form').hide(); $('.show-search').click(function() { $('#column-left form').stop(true, true).slideToggle(300); if( $('#column-left form').css('display') == 'none' ) { $("#offers").show(); } else { $('#offers').hide(); } });
It hides the div, but it does not return when I hide the form. It will be useful for any help :)
edit:
Well, I managed to achieve the desired effect by writing this:
$('#column-left form').hide(); $('.show-search').click(function() { if ($('#column-left form').is(":hidden")) { $('#column-left form').slideToggle(300); $('#offers').hide(); } else { $('#column-left form').slideToggle(300); $("#offers").show(); } });
I do not know if it is written correctly, but it works;) Thank you all for your help!
jquery if-statement hide show visible
Tomarz Dec 23 '11 at 12:22 2011-12-23 12:22
source share