Mootools Slide Toggle

/ Published in: JavaScript
Save to your folder(s)

Very basic way to toggle an element to slide in and out using mootools 1.1. Uses FX.Slide, other transitions are available.

Copy this code and paste it in your HTML
  1. function toggleSlide(){
  2. //Select the element you wish to slide
  3. var mySlide = new Fx.Slide('slide');
  5. //Create a slide in/out
  6. $('theSlide').addEvent('click', function(e){//add the click function (i.e on an anchor)
  7. e = new Event(e);//create a new event here
  8. mySlide.toggle();//do this to the selected element
  9. e.stop();//stop the event
  10. });
  11. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.