JavaScript:

An overview of how JavaScript works with the course websites

Everything on this page applies to the w19 and later course repos.

In the main Jekyll theme, there is JavaScript code that is loaded for

There is also custom JavaScript code that runs to

If you want custom JavaScript to be loaded for a particular site, you can create a directory called assets/js and put, for example, cs111_head.js in that directory, i.e. (/assets/js/cs111_head.js).

You can set the name of the script (or scripts) in _config.yml that you want to run in the head of each page, like this:

head_scripts: 
   - /assets/js/cs111_head.js

For best results, use JQuery syntax to indicate scripts that should be run when the page is loaded. For example:

$( document ).ready(function() {
    console.log( "cs111_head.js" );
});

Related topics: