Jquery Sliding

Posted October 21st, 2009 in Web Development by Jon

The Project

In one of my projects, I thought it would be cool to have a drop down select box trigger a slide down for the results, then slide up and slide back down when a new choice was selected. Seemed pretty easy, but when I got into it, it wasn’t as easy as I thought at first. But in all reality it turned out to be super easy.

I did some digging around to figure out how to tell if my div container (the one that would hold all the results) was visible or not, maybe I should just read the entire JQuery documentation – HA! Instead I turned to google and found that you can check for :hidden.

$("#div-id").is(":hidden");

So I can base my logic on that, if it’s hidden do this or if it’s not do this…

That was perfect, now it was just a matter of having it do exactly what I wanted. So if the div wasn’t hidden, I needed to hide then show it again with the new results. Or if it was hidden, show the results. Continue Reading »