Unit 4: Basic Dynamic Sites
Given that this course has CS pre-requisites, we’re assuming you’re comfortable with progamming basics such as variables, loops, and functions. If you’d like to review some programming basics within the context of JavaScript, you may refer to the material below:
- Read Hello, World! and Code Structure
- Read Pop-up Boxes
- Read Variables and Types and Operators
- Read Conditions and Loops
- Read Functions
- Watch this Intro to JavaScript playlist
Unit Essential Questions
You should use the questions below to assess your own learning and understanding of course material. These questions are also a good method of organization if you’re taking notes.
JavaScript
- How can I use JavaScript to modify websites?
- How can I use JavaScript to make sites interactive?
- What are event handlers and how are they used?
- How do I ensure the addition of JavaScript doesn’t negatively impact the accessibility of my site?
jQuery [optional]
- What’s the difference between JavaScript (JS) and jQuery (JQ)?
- How does the syntax of JQ differ from that of JS?
- What are JQ pseudo-selectors and how do they work?
- How do event handlers work in JQ?
- How do animations work in JQ?
Unit Readings
JavaScript
- Read DOM tree and/or Watch Document Object Model
- Read Accessible JavaScript Overview of Accessible JavaScript and Other Issues
- Read Searching: getElement, querySelector and/or Watch:
- Read Interaction: alert, prompt, confirm
- Read Accessible JavaScript: JavaScript Event Handlers
- Read Mouse events basics and/or Watch Intro to events
- Read Moving the mouse and/or Watch The mouseover event
Check your understanding
This optional exercise will have you practice with JavaScript before you start working on your assignment. Complete the three functions for this fish site JSFiddle.
Make sure you don’t change anything in the HTML or CSS! You only need to add code to the JavaScript box– there are 3 functions you need to complete, each associated with one of the three buttons on the fish site.
Note: JSFiddle is a ‘coding playground’ that automatically links the HTML, CSS, and JS windows together so you don’t have to. It’s great for small code examples and similar to CodePen and many other ‘coding playgrounds’
jQuery [optional]
While not required, you will likely encounter jQuery syntax in the wild (especially on older BootStrap tutorials/videos) so it’s helpful to at least be familiar with its syntax. Additionally, jQuery offers some nice built-in functions that in JavaScript would require your own manual implementation, so it’s really useful for minimizing programming effort.
- Read Difference Between JavaScript And jQuery
- Read How jQuery Works
- Read Selecting Elements
- Review jQuery’s Events Documentation
- Review jQuery’s Effects Documentation
- Watch jQuery playlist
Check your understanding
This optional exercise will have you practice with jQuery before you start working on your assignment. Complete the three functions for this fish site JSFiddle.
Make sure you don’t change anything in the HTML or CSS! You only need to add code to the JavaScript box– there are 3 functions you need to complete, each associated with one of the three buttons on the fish site. Make sure to use jQuery rather than JavaScript to complete these functions.
Unit Lab
This assignment will have you practice using JavaScript to make your sites interactive. Make sure to refer to the unit readings for helpful reference material as well as additional resources.
Description
Choose 2 interactive features to add to your site. You may come up with your own or choose from some of the options below:
- Add a Font Size Adjuster that allows users to increase and decrease the size of the font on your site
- Add a Font Type Adjuster that allows users to change the font on your site (e.g., serif, sans-serif)
- Add a Theme Switcher that allows users to change the color schemes on your site (e.g., light mode, dark mode, high contrast mode)
- Add some effects for your images (e.g., enlarging on click, caption on hover)
Of course, it’s imperative that we ensure our site continues to be accessible as we add new/more features and change our code. Perform some basic accessibility testing using your browsers’ built-in dev tools (refer to Unit 2 readings as needed) and any of our posted accessibility testing resources.
At a minimum, your site should:
- Be keyboard-only navigable including:
- All buttons, links, and inputs are can be selected (reached) without a mouse (i.e., via tabbing)
- Any element currently selected (in-focus) is perceivably different (e.g., underlined or boxed)
- All buttons, links, and inputs are can be activated (clicked) without a mouse
- There are no ‘keyboard traps’
- Be screen-reader friendly including
- Headings are used logically and with no skipped heading numbers
- All pages have accurate page titles and metadata
1. Code makes appropriate use of semantic HTML including use of
<nav>
and<main>
, and others as applicable 1.<div>
s and<span>
s are used sparingly and only where semantic HTML wouldn’t make sense - All images have appropriate alt text
- Have sufficient contrast (applicable to all themes if that’s one of the features you choose)
- Have an option to enable and disable any automatic animations
- Is usable with up to 400% magnification
- Is usable with stylesheets disabled
- Is usable with images disabled
- Is usable with JavaScript disabled
- Is usable across various browsers
- Is usable across various devices of various sizes
If you have any questions about what the above entail, please first refer to our posted accessibility resources– the General Tips section might be of particular use.
Additionally, you’ll be submitting your code for review this week so please make sure your code is free of errors and that your site is complete.
Recorded Lecture
The lecture below provides additional information on integrating JavaScript and jQuery into a site which you may find particularly useful for completing your assignment. However, if you feel comfortable with the material already, you may choose to skip watching this lecture. Copies of the completed JS and JQ code are available for download (you might have to right-click to save/download): Code using JS | Code using JQ .
What to Submit
Create a short README text document in your site’s root folder describing the interactive features you chose to implement and what their expected behaviour is. Zip/Compress this root folder, ensuring your site works as expeceted from the files in that folder alone, and submit it. Remember all submissions are done through Canvas.
Requirements
Submission
- Site runs from files in zipped/compressed folder
- All links and images work
- Folder includes a README describing the interactive features implemented and their expected behaviour
Design and User Experience
- Site has a good, cohesive design
- Site is responsive and mobile-friendly including:
- Is usable across various browsers
- Is usable across various devices of various sizes
- Site is dynamic: at least two interactive features are implemented and behave as expected/described
- Site is accessible. At a minimum, site:
- Is keyboard-only navigable including:
- All buttons, links, and inputs are can be selected (reached) without a mouse (i.e., via tabbing)
- Any element currently selected (in-focus) is perceivably different (e.g., underlined or boxed)
- All buttons, links, and inputs are can be activated (clicked) without a mouse
- There are no ‘keyboard traps’
- Is screen-reader friendly including:
- Headings are used logically and with no skipped heading numbers
- All pages have accurate page titles and metadata
1. Code makes appropriate use of semantic HTML including use of
<nav>
and<main>
, and others as applicable 1.<div>
s and<span>
s are used sparingly and only where semantic HTML wouldn’t make sense - All images have appropriate alt text
- Has sufficient contrast (applicable to all themes if that’s one of the features implemented)
- Has an option to enable and disable any automatic animations
- Is usable with up to 400% magnification
- Is usable with stylesheets disabled
- Is usable with images disabled
- Is usable with JavaScript disabled
- Is keyboard-only navigable including:
Programming
- HTML and CSS are free of syntax errors
- JS (and JQ, if used) is free of syntax errors
- JS (and JQ, if used) is used appropriately and efficiently
- Browser console gives no errors
- Browser console gives no warnings
Organization
- CSS is in external stylesheet
- JS is in external script
- JQ, if used, is in external script
- Images are in their own folder
- Scripts are in their own folder
Additional Resources
JavaScript
- Review JavaScript CheatSheet
- Review W3School’s JavaScript Tutorial
- Watch Web Programming with JavaScript (YouTube Playlist, with some repeats from above)
- Read Handling common JavaScript problems
Accessible JavaScript
- Read CSS and JavaScript accessibility best practices
- Read Handling common [JavaScript] accessibility problems
- Read Handling common accessibility problems
jQuery
- Review jQuery Cheat Sheet
- Review jQuery Cheat Guide
- Review TutorialsPoint jQuery Tutorial
- Refer to jQuery Docs
- Watch JQuery Tutorial for Beginners playlist