I am wondering if there is a certain way to use javascript in modx? I am trying to use javascript for a navigation menu. I just have it in a script folder and call it that way. It isn’t working properly in modx, but if I pull the index.html file out into is own folder without modx and run it that way it works fine. Exact same files just not run from modx. Is there something I am missing about the way modx does things? Should I be setting up the javascript a different way?
There are no trick to using js in modx, the paths need to be correct but that is true anywhere. What happens? Does it just not work? If this is the case it may not be finding it. If you do not have one, try adding a <base> tag in your html head?
Probably a bad idea to use javascript for navigation if the links are generated in the js - bad from an seo point of view.
Get firefox, web developers toolbar and firebug. That will help you find out what you are doing wrong. 99% chance your paths are wrong.
when you say it doesn’t work - is this occuring when you are LOGGED into the manager, and viewing the page also? I have noticed in the past that sometimes if I am logged into the manager and viewing a site (using the same browser) it can cause problems with some Javascript...
-
☆ A M B ☆
- 24,524 Posts
That’s because the QuickEdit javascript libraries can cause conflicts with the libraries you’re using. You can disable QuickEdit by going to Resources, Manage Resources, the Plugin tab, click on QuickEdit, and check the Disable plugin box, then save it.
can you cut and paste the source that is on your laptop (the one not working)? so I can have a look at it, save you having to upload the site.