JS & JQuery – Reusable Code

DSU Web Services is in the process of making our website’s design more modular, meaning that codes and styles are broken up into small pieces that can be easily reused.

This is very much a work in progress, but below you will find documentation on some of the reusable Javascript and JQuery code snippets we have developed for the web team and more experienced editors to use.

We recommend always using existing Javascript and JQuery code rather than writing your own, because WordPress has a tendency to break content pages if rendered weird in the Page/Post editor(it does this because the editor is for content, not JS/JQuery!).

Basic How To Use

If something is breaking, try to add this line before the code snippet to remove WordPress’s formatting:
<!-- noformat on -->

Code snippets should be placed at the bottom of your content editor, and looks like this:
<script src="https://dixie.edu/sourcecode.js"></script>

And if you need to use formatting after the code, resume WordPress’s formatting:
<!-- noformat off -->


Dropdown Menus

Documentation Code Snippet


Hover Info

Documentation Code Snippet


Copy Paste

Documentation Code Snippet


Button Tab Switching

Documentation Code Snippet