/ Published in: JavaScript
Very basic way to toggle an element to slide in and out using mootools 1.1. Uses FX.Slide, other transitions are available.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function toggleSlide(){ //Select the element you wish to slide var mySlide = new Fx.Slide('slide'); //Create a slide in/out $('theSlide').addEvent('click', function(e){//add the click function (i.e on an anchor) e = new Event(e);//create a new event here mySlide.toggle();//do this to the selected element e.stop();//stop the event }); }