Java push content down script?

Hi,

Im new to javascript. I want to add a similar function on my blog like on http://techcrunch.com/2011/08/04/groupon-acquires-software-devlopment-startup-obtiva/ when you press on author. It is a drop down made with javascript. Anybody can help with a similar javascript as I was trying different implementations for the whole night with no luck.

Maybe, anybody know a similar javascript online which I could modify?

Thanks in advance!

Hi Donatas.

Something like that could be achieved quite easily using some very basic HTML and jQuery, steps involved are:

  • Have a clickable item (e.g. author name)
  • Below it have a div with all the information
  • On page load, hide the div with JavaScript( $(document).ready() in jQuery terms)
  • Add a click event to the clickable item to perform a slideToggle() on the div you’ve hidden.

To get you started, your HTML would look something like this:

<a id="btnAuthor">Author name</a>
<div id="authorInfo"> <p>Info goes here</p> </div>

And to start, put this in your JavaScript (Assuming your HTML page already includes a reference to jQuery)

$(document).ready(function(){
  //Add a click handler for the link 
  //and perform a slideToggle inside of the callback function
});