We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Following up on an older post I made (Have a script.aculo.us effect triggered on page load : how ??), I’ll share a bit of code I now use to replace the script.aculo.us code for my appear effect.

    The script.aculo.us stuff looked like this :

    <script type="text/javascript"><!-- // --><![CDATA[
    
    	/* Observe when page loads and run the "init" function */
    	Event.observe(window, 'load', init, false);
    
    	/* When page is loaded, this function is called */
    	function init()
    	{
               new Effect.Opacity('submenu', {duration:1.5, from:0.2, to:1.0});
     	}
    
    	// ]]>
    
    </script>


    The new one (I’ll refine the code later - I am just a mootools beginner) based used with mootools 1.0 :

    <script type="text/javascript">
    
    window.addEvent('load', function() {
    var myFx = new Fx.Style('submenu', 'opacity').start(0,1);
    });
    
    </script>
    


    I am using window.addEvent because window.onLoad is to be deprecated soon...

    Hope it’ll help someone, I had to guess and test before it worked, not many examples for mootools yet (at least examples for laymen like me tongue)

    If someone has corrections or suggestions, I’d be happy to learn more !

      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l&#39;outil id
      • 1379
      • 22 Posts
      can anyone tell me what is this effect.
        Regards
        Amitav Roy
        Web Designer
        Website: http://www.pixelgroups.com
        Portal: http://www.creativeporta.com
        • 6726
        • 7,075 Posts
        This effect is just a fading in setting opacity thanks to js on page load, I have no demo handy at the time... I’ll post a link a bit later...
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 867
          • 241 Posts
          Hi

          Do we have to include mootools on the page ?
          What else (kind of effects) can be achevied ?

          Thanks
            • 6726
            • 7,075 Posts
            Yes as for any js library/framework you have to include a call to the library, indeed.

            Note : Remember though that using mootools will conflict with MODx 0.9.5 when you’re logged in : QuickEdit uses script.aculo.us which conflicts with mootools (or any other js framework for that matter). With MODx 0.9.6, QuickEdit has switched over to mootols thus you’ll be fine. This won’t affect your visitors who don’t have QuickEdit but it will prevent you MODx users to enjoy QuickEdit AND your script.aculo.us effects...

            You can achieve pretty much anything with mootools smiley But same is true of jQuery, really nice too...
            But it takes work ! I am learning it bit by bit myself... it’s really powerful !

            I am afraid the documentation will be hard on js beginners, it’s very clear and nicely done but it suppose that you have decent knowledge of javascript : don’t expect the framework to do the work for you.

            The documentation :
            http://docs.mootools.net/

            The mootools tutorial or mootorial :
            http://clientside.cnet.com/wiki/mootorial/

            Hope it helps smiley
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 8216
              • 15 Posts
              I’m certainly not a heavy JS coder but have been using it since it wasn’t cool wink and I have found the documentation for MooTools totally incomprehensible! If someone knows of a really good bigginers’ tut then please post the URL.

              The Mootorial looks very flash but it’s just such a hard nut to crack.
                modx ist rad
                • 6726
                • 7,075 Posts
                Yeah I know what you mean... the doc itself IS nice but for js coders (then again, js frameworks do not aim to provide an "out of the box" solution.
                What I miss in this doc is context. Most of the time you have no html sample, just plain js without context.

                For example I found var myFx = new Fx.Style(’submenu’, ’opacity’).start(0,1); in the doc, but I had to dig to understand that I had to use window.addEvent and wrap the sample code into a function...

                I’ll sure catch up with javascript basics before I go on digging... and if I manage to master it, I’ll write a few tutos myself smiley
                Given the power of mootools, it’s worth the effort though...

                There are indeed very few tutorials so far, found this one and it’s how I got to understand how I add to write the call for the effect, but there are not many easy tutos around agreed...
                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l&#39;outil id