Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1061401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:28:07+00:00 2026-05-16T18:28:07+00:00

I am using Mootools extensively for a site which I am developing. But recently

  • 0

I am using Mootools extensively for a site which I am developing. But recently I noticed a problem that the animations slow down alot when I zoom (using the browsers Zoom In) in into the site. What could be a possible reason for this problem ? Or is this problem inherit in Mootools itself. This happens in Chrome 6.0.472 as well as Firefox 3.6.8.

Thanks,
Nitin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:28:07+00:00Added an answer on May 16, 2026 at 6:28 pm

    many things are wrong here with regards to speed optimisations.

    lets take a look at this mouseover code that seems to slow down:

    this.childNodes.item(1).style.left="0px";
    this.getElements('div').setStyles({'opacity':'1'});
    this.getElements('div').set('morph', {duration:'normal',transition: 'sine:out'});
    this.getElements('span').set('morph', {duration:'normal',transition: 'sine:out'});
    this.getElements('div').morph({'left':'-28px'});
    this.getElements('span').morph({'left':'-30px','color':'#FFF'});
    

    obviously this will work as it does but it’s so very wrong i don’t know where to begin.

    the idea is to abstract and setup the repetitive tasks so they are done as a one off.

    consider line by line the code above:

    this.childNodes.item(1).style.left="0px";

    this is wrong for a mootools app anyway, it would need to be this.getFirst().setStyle("left", 0);

    the this.getFirst() is a lookup, it should be cached – although that’s not a slow one.

    then comes the bad part.

    you select all child divs 3 times and all spans twice, where NO SELECTION should be applicable. VERY EXPENSIVE

    you reset the Fx.morph options every mouseover event where there are no changes (although you seem to have a different duration for mouseenter and mouseleave – this is expensive)

    consider this code:

    [document.id("menu1"), document.id("menu2")].each(function(el) {
        // use element storage to save lookups during events
        el.store("first", el.getFirst());
        el.store("divs", el.getElements("div"));
        el.store("spans", el.getElements("span"));
    
        // store the fx.morph options once and for all, no need to do so
        // on every event unless you are changing something
        el.retrieve("divs").set("morph", {
            duration: 'normal',
            transition: 'sine:out',
            link: 'cancel'
        });
    
        el.retrieve("spans").set("morph", {
            duration: 'normal',
            transition: 'sine:out',
            link: 'cancel'
        });
    
        // add the events
        el.addEvents({
            mouseenter: function(e) {
                // retrieve the saved selectors from storage and do effects
                this.retrieve("first").setStyle("left", 0);
                this.retrieve("divs").morph({
                    "left": -28
                });
                this.retrieve("spans").morph({
                    'left': '-30px',
                    'color': '#FFF'
                });
            }
        });
    });
    

    it will save a lot of processing on the events.

    similarly, there are plenty of places where you are not really using the mootools api.

    document.getElementById(curr).style.cursor="pointer";
    $(this).removeEvents -> no need for $, this is not jquery.
    document.getElementById("lightbox").style.visibility="hidden";
    m=setTimeout('gallery()',5000); –> use the mootools var timer = (function() { ... }).delay(5000);, don’t use strings with setTimeout/interval as it forces eval and reflows but pure anon functions

    etc etc.

    you really can make a day out of refactoring all this and making it ‘nice’ but it’s going to be worth it.

    also, learn about chaining

    $("ribbon").set('morph', {duration:'long',transition: 'bounce:out'});
    $("ribbon").morph({'top':'-10px'});
    $("ribbon").addEvents({
    

    this is calling up a selector 3 times. instead you can:

    1. store it. var ribbon = $("ribbon"); ribbon.set...
    2. chain it. $("ribbon").set("morph", {duration: 500}).morph({top:-10}).addEvents() – mootools element methods tend to return the original element so you can take the response of the last function and apply more to it.

    1 is better for readibility, 2 is faster to do.

    also. you have way too many global variables which makes your scope chain lookups more expensive, this will affect many call ups and places. try to namespace properly, if you need to access real global vars from functions and closures, use window.varname etc etc.

    Another possible improvement here would be the use of event delegation (event bubbling will cause events to fire up the dom tree to the parents, mootools has an api to deal with it so you can add singular events to parent elements and not have to attach nnn events to all children) – look it up.

    P.S. please don’t take this in the wrong way – it’s not meant to rubbish your work and it’s just some constructive (i hope) advice that can help you bring it to the next level. good luck 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed a lot of JQuery answers on this, but I'm using MooTools... I
I've been working on some simple AJAX functions recently, using MooTools. My problem lies
I've been using Mootools for the last couple of months without knowing that MS
I have a jQuery code, but need it working by using Mootools: if (
I made a script (using mootools library) that is supposed to overlay an image
I noticed that sometimes(randomly) my Mootools ajax request gets send twice. The second request
I'm using mootools 1.4.1 and I'm trying to get a div that 'tweens' the
I've got a script using mootools 1.1 to handle an Ajax form that has
I m using mootools 1.1 for developing joomla component. i want to get the
I'm using Mootools in a joomla site. I want to do a basic banner

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.