We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    I try to make this demo working on my modx installation: http://demos.mootools.net/Accordion

    But when I just copy all data into a page it doesn’t work. I just see all the text expanded.
    How can I use mootools just on a single page?
      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 25663 MODX Staff
      • 12,272 Posts
      Create a new template specifically for the page needing mootools. Or you could also create a TV for adding additional things to the document head and assign it to your template, where you add any page-specific javascript or CSS.

      As far as mootools-specific questions, MODx shouldn’t do anything to change what you tell it to output, so you’ll just have to go through it line by line until you figure out what’s missing.

      Good luck!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 19726
        • 239 Posts
        Getting the mootools examples to work is a bit of a pain if you just look at the demos. They only give a bit of code and assume you know where to put it. I would suggest to take a look at the real page source to see where the stuff belongs. Also you might run into problems when you have quickedit enabled, because that also uses mootools and if you have a different version you might have a conflict.

        In short your page/template should look a bit like this (note the code below is untested, but I believe it is OK):
        <head>
          <style type="text/css">
        
            ... Put the CSS code from the demo page here ...
        
          </style>
        
          <!-- Make sure mootools is included before trying to make the accordeon -->
          <script src="mootools.v1.11.js" type="text/javascript" charset="utf-8"></script>
          <script type="text/javascript">
            window.addEvent('domready', function(){
        
              ... Add the js code from the demo page here ...
        
            }); 
          </script>
        
        </head>
        <body>
        
          ... Put the HTML code from the demo page here ...
        
        </body>