History: Add external JavaScript
Source of version: 7 (current)
Copy to clipboard
! {{page}} This is a short ((Tutorial)). {REMARKSBOX(type="info" title="Hint")}In Tiki pre-14 trunk, the old structure ''"styles/mytheme.css - styles/mytheme/*" - "templates/styles/mytheme"'' is not working anymore, it became deprecated for the release of Tiki14. __"templates/styles/mytheme" files should be moved manually to "themes/mytheme/templates" folder__. In case of questions please contact the Tiki artwork-list on sourceforge: [https://lists.sourceforge.net/mailman/listinfo/tikiwiki-artwork] {REMARKSBOX} You can do it in various ways. Some devs usually use -+styles/custom.js+- (or -+styles/mytheme/custom.js+-) to do most of their custom ((JS)) stuff, mainly so they can use a proper editor that checks for typos etc (and edits via s/ftp etc) Or you can use the Custom JS pref: -+header_custom_js+- (which actually appears after the JS includes). In there you can use the jQuery -+$.getScript+- command to load the 3rd party files - like this: {CODE(caption="Script to include" colors="javascript" ln="1")} $(document).ready( function () { $.getScript("files/some-fancy-library-file.js", function () { // Add the code to execute once the library has loaded here // .... }); }); {CODE} {REMARKSBOX(type="info" title="Hint")}In Tiki pre-14 trunk, the old structure ''"styles/mytheme.css - styles/mytheme/*" - "templates/styles/mytheme"'' is not working anymore, it became deprecated for the release of Tiki14. __"templates/styles/mytheme" files should be moved manually to "themes/mytheme/templates" folder__. In case of questions please contact the Tiki artwork-list on sourceforge: [https://lists.sourceforge.net/mailman/listinfo/tikiwiki-artwork] {REMARKSBOX} More here: http://api.jquery.com/jQuery.getScript/ (alias(Add external js script))