Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript More/Less button sliding animation?

Tags:

javascript

I only have very basic knowledge on Javascript and I want to be able to make my more/less button that displays/hides content be an animated slide instead of an instant change. Here is the Javascript I currently have:

function doMenu(item) {
    obj=document.getElementById(item);
    col=document.getElementById("x" + item);
    if (obj.style.display=="none") {
        obj.style.display="block";
        col.innerHTML="[-] Less";
    } else {
        obj.style.display="none";
        col.innerHTML="[+] More";
    }
}

Does anyone know how I can change this Javascript to slide instead?

EDIT An example of the link I use to show/hide content

<a href="JavaScript:doMenu('main');" id=xmain>[+] More</a>
like image 539
tnw Avatar asked Jun 23 '26 21:06

tnw


1 Answers

check out the jquery library(slidedown): w3 schools jquery- jquery.com

like image 170
d3m Avatar answered Jun 26 '26 11:06

d3m



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!