9/06/2010

Simple Jquery Show/Hide Div

Here’s a simple tutorial on how to show/ hide a div using Jquery. First we include the Google Jquery link, the next steps simple. it’s just a function that toggles the div with an id of slidingDiv, the height attribute means that the div will slide in from the top this can be changed to ‘width’ in order for the div to slide in from the left. We also set the duration of the animation which in our case is 1 second.

The JavaScript:

01
02

The HTML:

01<a onclick="ShowHide(); return false;" href="#">Show/hidea>
02<div id="slidingDiv">
03
04Fill this space with really interesting content that you can <a onclick="ShowHide(); return false;" href="#">hidea>div>

Although this code technique is simple its often required in projects.

demodownload

This entry was posted in Design, Downloads, Javascript, Tutorials, jQuery and tagged , . Bookmark the permalink.

No comments: