It always works when used in the correct way.

Open up the Firebug, enable the console and check if it throws any errors. 

Tween will not work with MooTools versions prior to 1.2.0

On 2010-09-10, at 21:49, WhyNotSmile wrote:

> It seems to work on some sites, and not others.  The client is
> producing this code, storing it on their server, and allowing other
> sites to link to it.  On some sites, it works fine, but on others it
> doesn't.  Would it be that the others are using a different version of
> mootools or something like that?
> 
> Sharon
> 
> 
> 
> On 10 Sep, 18:00, Oskar Krawczyk <[email protected]> wrote:
>> The provided code works just fine:http://www.jsfiddle.net/oskar/RUZCh/
>> 
>> O.
>> 
>> On 2010-09-10, at 15:08, WhyNotSmile wrote:
>> 
>>> Hi folks, I'm having some difficulty with a script which uses
>>> Mootools.  I have taken over this script from someone else, so I'm not
>>> entirely sure how it works and what it uses, but as far as I can see
>>> it is a straightforward use of Mootools (as far as I can tell, it's
>>> version 1.2.0 - I don't particularly want to change the version, as I
>>> don't know what else might be using it).
>> 
>>> I'm using this to expand an image when it is hovered over.  The idea
>>> is that the transition is a 'tween', with the image height going from
>>> 45px to 65px.
>> 
>>> The javascript code is (this is applied to each image):
>> 
>>>   function(el,index){
>>>    // Set up transition
>>>    var tween = new Fx.Tween(el);
>>>    el.style.height = '45px';
>>>    // Attach event handlers
>>>    el.addEvents(
>>>     {
>>>      'mouseenter' : function() {
>>>        el.tween('height', [45, 65]);
>>>      },
>>>      'mouseleave' : function() {
>>>        el.tween('height', [65, 45]);
>>>      }
>>>     }
>>>    );
>>>   }
>> 
>>> When I mouseover, nothing happens.  I put in some alerts, and as far
>>> as i can tell, it's getting to the .mouseenter' function ok, but then
>>> failing when 'start' gets called for the tween.  The particular line
>>> in mootools.js that it seems to fail on is
>>>  var B=Array.flatten(arguments);
>>> The arguments array at this point is [["height", [65, 45]]].
>> 
>>> On digging in further, it seems to be this section that's the problem:
>> 
>>> flatten: function() {
>>> return this.inject([], function(array, value) {
>>> return array.concat(Object.isArray(value) ?
>>> value.flatten() : [value]);
>>> });
>>> }
>> 
>>> I don't really understand what this is doing, so not sure how to fix
>>> it.  It may be that the problem is earlier than this, and that the
>>> value in arguments is, by this stage, invalid, and that's causing it
>>> to bail out.
>> 
>>> Can anyone help?  Thank you all very much.
>> 
>>> I can supply more code if it's needed.

Reply via email to