On my website, I use some simple jQuery to slide down and up an existing element.
$('#menu li:first strong').bind('click', function() {
var searchBox = $(this).parent().find('form');
if (searchBox.is(':hidden')) {
//$('#menu #advanced-search-block').hide();
searchBox.slideDown(1000);
} else {
searchBox.slideUp(1000);
}
});
Inside of the parent <li>
element are some elements of which their CSS is set to display: none
. When I click the element to trigger this event, the hidden elements appear. I have tried using the commented out code to remedy this (which it does), but I am thinking there should be a more elegant solution. I know you can use .stopPropogation() on events, so is there anything you can do to make slideDown() stop making child elements with display: none
visible?
Edit
Sorry about the lack of HTML guys. There is a fair bit of HTML around these elements, and I didn't want to post a huge amount of it. You can access the work in progress here: http://www.noosanativeplants.com.au/~new/ (If someone wants to post the offending markup, it would help other people in the future who find this question). Thank you