Photo by KOBU Agency on Unsplash
OMG JavaScript and jQuery are AWESOME!!
The first thing to learn is the Document Object Model (DOM). DOM is how you identify specific objects when interacting with those objects using JavaScript. Here is a good link that describes DOM: https://www.w3.org/TR/WD-DOM/introduction.html
Scripts are placed in between script tags <script></script>
JavaScript Tutorial: https://www.w3schools.com/js/
A JavaScript excerpt from my project site:
<script>
function leporeFunction() {
var x = document.getElementById("btnlepore");
x.style.background = "#99ced3";
var x = document.getElementById("btnlaw");
x.style.background = "white";
var x = document.getElementById("btnwilson");
x.style.background = "white";
var x = document.getElementById("leporediv");
x.style.display = "block";
var x = document.getElementById("leporetree");
x.style.display = "block";
var x = document.getElementById("lawdiv");
x.style.display = "none";
var x = document.getElementById("lawtree");
x.style.display = "none";
var x = document.getElementById("wilsondiv");
x.style.display = "none";
var x = document.getElementById("willtree");
x.style.display = "none";
}
Once you have a good handle on JavaScript syntax and DOM, you can dive into jQuery, which is an incredible library of JavaScript functions.
jQuery Link: https://jquery.com/
A jQuery excerpt from my project site:
<link href="booklet/src/jquery.booklet.latest.css" type="text/css" rel="stylesheet" media="screen, projection, tv" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script> window.jQuery || document.write('<script src="booklet/src/jquery-2.1.0.min.js"><\/script>') </script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script src="booklet/src/jquery.easing.1.3.js"></script>
<script src="booklet/src/jquery.booklet.latest.min.js"></script>
<script>
$(function() {
//single book
$('#mybook').booklet({
width: '100%',
height: '100%',
manual: false,
overlays:true,
arrows: true,
arrowsHide: true,
closed: true,
autoCenter: true,
keyboard: true,
tabs: true,
hovers: true,
hashTitleText: ' - ',
menu: '#custom-menu',
pageSelector: true });
});</script>