Hi,
i made a simple toggle visibility button with javascript and css:
Code:function toggle(iden) { if(document.getElementById(iden).className=="exp_open") { document.getElementById(iden).className="exp_close"; } else{ document.getElementById(iden).className="exp_open"; } }Code:.exp_close { display: none; } .exp_open { display: block; transition:all 1s; }what im trying to achieve is a smooth slide-like effect instead of having the element just appear and disappear by using css transition property but i really dont understand quite well how to use it. Could you please give me a hint?Code:<h2 onclick="toggle('block1');"></h2> <div id="block1" class="exp_close"></div>
Thank you.


Reply With Quote
Bookmarks