jQuery: Difference between revisions
From MoodleDocs
(Created page with "{{Moodle 2.5}} TODO: document jQuery support introduced in MDL-15727 skodak") |
No edit summary |
||
Line 1: | Line 1: | ||
{{Moodle 2.5}} | {{Moodle 2.5}} | ||
'''WORK IN PROGRESS''' | |||
YUI is the recommended library for development of Moodle plugins or customisations. However due to significant demand it will be possible to use also jQuery in Moodle 2.5 and later. | |||
==Examples== | |||
===Basic jQuery in custom theme=== | |||
# create /theme/sometheme/lib.php file if it does not exist yet | |||
# add new function theme_sometheme_page_init to the lib.php file (replace 'sometheme' with real name of your theme) | |||
# use jQuery in theme layout files | |||
<code php> | |||
// inside file: /theme/sometheme/lib.php file | |||
function theme_sometheme_page_init($page) { | |||
$page->requires->jquery(); | |||
} | |||
</code> | |||
===Basic jQuery in activity module=== |
Revision as of 14:32, 19 March 2013
Moodle 2.5
WORK IN PROGRESS
YUI is the recommended library for development of Moodle plugins or customisations. However due to significant demand it will be possible to use also jQuery in Moodle 2.5 and later.
Examples
Basic jQuery in custom theme
- create /theme/sometheme/lib.php file if it does not exist yet
- add new function theme_sometheme_page_init to the lib.php file (replace 'sometheme' with real name of your theme)
- use jQuery in theme layout files
// inside file: /theme/sometheme/lib.php file
function theme_sometheme_page_init($page) {
$page->requires->jquery();
}