Currently browsing JavaScript

Tuesday, May 2, 2023

How to declare a global variable inside a jQuery function

A JavaScript global variable is a variable with global scope, meaning that it is visible and accessible throughout the program, unless…

Tuesday, May 17, 2022

JavaScript Terminal

Today’s tutorial is about creating a terminal screen together with lime terminal characters in JavaScript. Let’s start with the CSS:…

Friday, June 3, 2022

Demystifying JavaScript history.back() and history.go() methods

One of my clients needed his online shop customers to be able to go back several steps with one click…

Monday, May 16, 2022

How to check scroll depth using JavaScript

This function checks after each scroll event to see if a visitor has achieved certain scroll depth milestones. In the…

Friday, June 3, 2022

How to execute code for X visits

This JavaScript will let you execute code a certain number of times. For example, you might want to only show…

Monday, July 8, 2024

Canvas: Animation

Making an animation from an element on an HTML5 Canvas is easy enough. To do this, a timer is set that…

Monday, July 8, 2024

Canvas: Interactive Shapes

If you draw a red square on a Canvas using the stroke() or fill() method, the square becomes nothing more…

Monday, July 8, 2024

Canvas: Inserting Images and Text

You can optimize text input by storing the desired text in an image file and then displaying it on the…

Monday, July 8, 2024

Canvas: Shadows and Gradient Fill

This is a Canvas programming introductory series: So far, we’ve been using solid colors to draw and fill elements on…

Monday, July 8, 2024

Canvas: Transforms and Transparency

Transform is a drawing technique that allows you to move the coordinate system of the Canvas using JavaScript.

Monday, July 8, 2024

Canvas: An Awesome Introduction

The ID attribute gives this Canvas the unique name required for it to be identified by JavaScript code and set…

Friday, June 3, 2022

How to create a simple JavaScript percentage graph (or chart)

This small JavaScript snippet creates percentage graphs out of raw (array) data. Just input the name/value pairs of the involved…