Results 1 to 5 of 5

Thread: AJAX mootools Fx.Tween problem

  1. #1
    Join Date
    Nov 2008
    Posts
    1,022

    AJAX mootools Fx.Tween problem

    I wrote a piece of code which would simply allow a gradual change in color of a link during the passage of the mouse. But nothing happens gives me an error.

    My piece of code,

    HTML Code:
     <html> 
      <head> 
      <script type= "text/javascript" src= "mootools-1.2.1-core-nc.js"> </script> 
      <script type= "text/javascript" >
      window. addEvent ( 'domready', function () {
      var list = $$ ( 'a'); 
      list. each (function (element) {
      var fx = new Fx. Tween ( element, { duration: 500 , wait: false } ) ;
      element. addEvents ({
      'mouseenter' : function ( ) {
      fx. start ({'color': '#999'}); 
      }, 
      'mouseout': function () {
      fx. start ({'color': '# 000'}); 
      }
      }); 
      }); 
      }); 
      </script> 
      </head> 
      <body> 
      <a href= "http://google.co.in">Google </a> 
      </body> 
      </html>
    If I remove the code fx.start (...) and replace it by an alert (element), the error message disappears and I can see the window alert () in the URL.

    If someone has an idea ...

  2. #2
    Join Date
    May 2008
    Posts
    271

    Re: AJAX mootools Fx.Tween problem

    I have a doubt about the syntax of your dict (lines 11 and 14):

    Try
    fx.start({ color : '#xxx' });
    without quotes around 'color'

  3. #3
    Join Date
    May 2008
    Posts
    685

    Re: AJAX mootools Fx.Tween problem

    I do not know about mootools and I do not have much time to watch your stuff, but in general tips when you do JS: install firebug (Firefox extension), and instead to alert (foobar), do console.log (foobar), it allows you to log objects and see all their values, properties etc..

  4. #4
    Join Date
    May 2008
    Posts
    3,971

    Re: AJAX mootools Fx.Tween problem

    have you tried this:

    Code:
     fx.start ( 'color': '#999');
    If you did not specify what property you are going to change (here, color) in the constructor, then you must necessarily pass this property as the first argument to the call to start ().

  5. #5
    Join Date
    Nov 2008
    Posts
    1,022

    Re: AJAX mootools Fx.Tween problem

    Well, it was almost, it was not to pass a dict fx.start (), but direct ownership
    replace

    Code:
    fx. start ( { 'color' : '#xxx' } ) ;
    by

    Code:
    fx. start ( 'color' , '#xxx' ) ;
    with "," to separate and not ":"

    Everything is now normal, thanks anyways.

Similar Threads

  1. what is ajax?
    By carmelmonteverdeinn in forum Software Development
    Replies: 1
    Last Post: 28-07-2010, 11:34 AM
  2. jQuery AJAX vs. Adobe AIR AJAX Class
    By Agaev in forum Windows Software
    Replies: 5
    Last Post: 06-07-2010, 01:59 PM
  3. PHP Vs AJAX
    By Happy46 in forum Software Development
    Replies: 3
    Last Post: 03-09-2009, 07:27 PM
  4. AJAX autosuggest problem in Opera (PLZ help)
    By diez777 in forum Technology & Internet
    Replies: 2
    Last Post: 22-06-2009, 11:45 PM
  5. What is AJAX in Asp.net ?
    By Braze in forum Software Development
    Replies: 5
    Last Post: 14-01-2009, 06:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,702,500.94989 seconds with 16 queries