Page 1 of 1

[solved] 1.11 to 1.2 accordion Migration

PostPosted: Tue Mar 09, 2010 6:20 pm
by Ivan
Problem to convert it to mootools 1.2

"1.11 to 1.2 Migration Guide" don't help me

http://www.solutoire.com/experiments/mo ... c_ex3.html

  1. var accordion;
  2. var accordionTogglers;
  3. var accordionContents;
  4.  
  5. window.onload = function() {
  6.  
  7. accordionTogglers = document.getElementsByClassName('accToggler');
  8.  
  9. accordionTogglers.each(function(toggler){
  10. //remember the original color
  11. toggler.origColor = toggler.getStyle('background-color');
  12. //set the effect
  13. toggler.fx = new Fx.Color(toggler, 'background-color');
  14. });
  15.  
  16. accordionContents = document.getElementsByClassName('accContent');
  17.  
  18. accordion = new Fx.Accordion(accordionTogglers,
  19. accordionContents,{
  20. //when an element is opened change the
  21. //background color to blue
  22. onActive: function(toggler){
  23. toggler.fx.toColor('#6899CE');
  24. },
  25. onBackground: function(toggler){
  26. //change the background color to the original (green)
  27. //color when another toggler is pressed
  28. toggler.setStyle('background-color', toggler.origColor);
  29. }
  30. });
  31. }

Re: 1.11 to 1.2 accordion Migration

PostPosted: Wed Mar 10, 2010 1:00 pm
by daKmoR
this is a little simplified version of it
http://jsfiddle.net/tKdxr/

Re: 1.11 to 1.2 accordion Migration

PostPosted: Fri Mar 12, 2010 6:28 pm
by Ivan
Thank you! :-)