General developer forum

Developing Moodle with JQuery - Moodle 3.3

 
Picture of Dave Emsley
Re: Developing Moodle with JQuery - Moodle 3.3
Particularly helpful Moodlers

For the benefit of anyone else struggling with this I've had a look at the theme "adaptive".

Their theme has this in the js file  (NB My theme is called  Curlew):

/* jshint ignore:start */
define(['jquery', 'theme_bootstrapbase/bootstrap', 'core/log'], function($, bootstrap, log) {

    "use strict"; // ... jshint ;_;.
    log.debug('Curlew StartUp function called');

    return {
        init: function() {
            $(document).ready(function($) {
                $(".fp-coursecat").click(function() {
                    $(this).css("border-color", "yellow");

                });       
            });
        }
    };
});
/* jshint ignore:end */

I've just chucked my jQuery into the same skeleton and it works IF I minify and add it to /amd/build/

Hope this is useful,

Dave

 
Average of ratings: -