Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The only code that I'm wrapping around it here, not surprisingly, is being called when the document loads and just so I can have a bit of interactivity, I am going to respond to an onclick event on the div called mainContent. I am going to execute this anonymous function that actually asks, what is that class? Is that class currently set to example? If it is, I am going to blank it out. If it isn't, I am going to set it to example. So you've just got a little toggle on/off here happening.
If I jump over and just open that up in the browser, right now that class is not being applied, but if I click anywhere in this main div, we're applying that class, which is actually setting this part of text to white, and just clicking back and forth. It's either applying the class or taking it off. Now, one thing to note, you can apply a class all you want, but it's still using the cascading rules of CSS, which means if there are more specific rules being applied to some of this content, say through ids or even inline styles, the closer ones are going to win.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 100068 Viewers
56 Video lessons · 113119 Viewers
71 Video lessons · 81977 Viewers
131 Video lessons · 39331 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.