This excercise will focus on copy/pasting code from sources and tweaking it to get it to behave the way we want it to.
It might help to define some of the things we'll be dealing with:
More on functions at w3schools and mdn docs.
Variables, written as 'var', 'let', or 'const', are "containers for storing data." In this example we'll be using a variable to create a shorthand way of referencing a longer string of text (in this case a 'method') that will be used to select an element in our HTML.
More on variables at w3schools and mdn docs.
More on events at w3schools.
First, let’s make a button that toggles a class on a specific div.
You'll often come across free to use and open-source plugins/code in spaces like github. The clarity and usefulness of the documentation will vary — but over time and with practice, parsing and understanding how to implement found code will only get faster and easier over time.
Before we jump into following the setup instructions on the github page, we'll need to prepare our document a bit.
You can read more on the w3schools jQuery intro
First, we'll need to download the latest “compressed production build” from here.
Copy the jQuery .js file into your website folder.
Next, we’ll create a link to it in our html document. We’ll place it at the bottom of the body:
Next, create a new file and name it something like “functions.js”. This will be the .js file where we will add our own functions to.
Now, we’ll just follow the install instructions on jQuery.marquee to set everything up!