Element Collection Manipulation Shortcut Using MooTools 1.2


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



Copy this code and paste it in your HTML
  1. // MooTools Looping Example (Bad/Long)
  2.  
  3. $$('.toggler').each(function(el) {
  4. el.addEvent('mouseenter',function(e) {
  5. el.fireEvent('click');
  6. });
  7. });
  8.  
  9.  
  10.  
  11. // MooTools Collection Example (Good/Short)
  12.  
  13. $$('.toggler').addEvent('mouseenter', function() { this.fireEvent('click'); });

URL: http://davidwalsh.name/element-collection-manipulation-shortcut-using-mootools

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.