Loading...
 

Add external JavaScript

This is a short Tutorial.

 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


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:

Script to include
$(document).ready( function () {
    $.getScript("files/some-fancy-library-file.js", function () {
        // Add the code to execute once the library has loaded here
        // ....
    });
});

 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


More here: http://api.jquery.com/jQuery.getScript/

Add external js script

List Slides