Page 1 of 1

Simple Animated Menu from Mootools 1.2 to Mootools 1.1

PostPosted: Tue Dec 29, 2009 11:21 pm
by stav
Can some one convert Simple Animated Menu for Mootools 1.2 to work with Mootools 1.1 please?
The menu is from this website http://www.consideropen.com/blog/2008/06/simple-mootools-12-animated-menu/

Below is the js code:
  1.  
  2. //Simle Animated Menu for Mootools 1.2 v1
  3. //Released June 2008
  4. //Dedicated to the public domain by http://www.consideropen.com
  5. var navArrowSlider = function(navWrap, navElementsArray, activeID, arrowY, leftOffset) {
  6.     var youAreHere = new Fx.Tween($(navWrap), {
  7.         duration: 1200,
  8.         transition: Fx.Transitions.Elastic.easeOut  
  9.     });
  10.  
  11.     $$(navElementsArray).each(function(item){  
  12.         item.addEvent('mouseenter', function() {
  13.             var thisPos = item.getPosition(navWrap).x  + item.getSize().x - leftOffset;
  14.             youAreHere.cancel();
  15.             youAreHere.start('background-position', thisPos + 'px ' + arrowY + 'px');
  16.         });
  17.     });
  18.    
  19.     var currentArrow = function() {
  20.         youAreHere.cancel();
  21.         var activePos = $(activeID).getPosition(navWrap).x  + $(activeID).getSize().x - leftOffset;
  22.         youAreHere.start('background-position', activePos + 'px ' + arrowY + 'px');      
  23.     };
  24.    
  25.     //correct IE rendering problem (without this, it wont go to the active nav onload)
  26.     var activePos = $(activeID).getPosition(navWrap).x  + $(activeID).getSize().x - leftOffset;
  27.     $(navWrap).setStyle('background-position', activePos + 'px ' + arrowY + 'px');      
  28.    
  29.     //works to set image to starting position in other browsers
  30.     currentArrow();
  31.    
  32.     $(navWrap).addEvent('mouseleave', currentArrow);   
  33. };
  34.    
  35. window.addEvent('domready', function() {
  36.     navArrowSlider(
  37.         'nav_wrap', // ID of nav wrap
  38.         '#nav_wrap ul li', // Array selector of nav elements
  39.         'active_nav', // ID of current nav element
  40.         '20px', //  Background position y of background image
  41.         '20' //  INT ONLY - How far left from the right edge of the nav element that the image settles
  42.     );  
  43. });
  44.  
  45.  


Thank you !!

Re: Simple Animated Menu from Mootools 1.2 to Mootools 1.1

PostPosted: Wed Dec 30, 2009 5:25 am
by wowenkho
try changing Fx.Tween to Fx.Style first, then tell me if it throws errors still.

Re: Simple Animated Menu from Mootools 1.2 to Mootools 1.1

PostPosted: Wed Dec 30, 2009 5:26 pm
by stav
I changed the Fx.Tween to Fx.Style and the js error that I'm getting now is overflown.each is not a function.
Attached is the menu source with motools1.2.js + included motools.1.1.js that i need to make to work with
and the changes that i made.

Thank you.