To check if the document is ready and execute some code, you bind an event listener to the DOMContentLoaded event of the document object.
A technique you can use to get all query string parameters and push them into an object of key/value pairs.
To get the width and height of an element, you use the offsetWidth and offsetHeight properties of the element.
How to get the width and height of the window in px.
To set or get the scroll position of an element, you use the properties scrollTop and scrollLeft of the element.
Use the Document.hidden property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.
These snippets will get the height and width of an image, one when it is loaded and another when the image is not loaded yet.
Use this script to delay the loading of a particular image. It can be used to delay the loading of large images or banner advertisements. A smaller image is loaded first, which can be transparent or blank. After a designated amount of time the larger image will load in place of the smaller one.
This unobtrusive script will update the current year for the copyright notice on a page. No need to worry about changing it from year to year. Very easy to implement.
A dynamic color wheel displaying 4096 colors in a chromatic scale utilizing cross browser mouse event capture from a layer to display the hexadecimal codes of each color. Easily find that elusive color code you were looking for and learn how to manage layers and mouse events.