Sunday , 17 December 2017
Event Management

Event Management – Advanced JavaScript Tutorial

This tutorial is based around event management. Just like anything else, creating events takes up memory. Creating multiple events can really slow the performance of your website. Let’s take a look at a couple of ways to still have all the events you want while still keeping your site running in tip top shape! Let’s update the body tags in …

Read More »
Device Events

Device Events – Advanced JavaScript Tutorial

Smartphones and tablets are devices that are frequently used to browse websites. JavaScript now has a couple of events for hand held devices.  For this tutorial, you’ll need to have a mobile phone. I’ll be using the Iphone for this tutorial. Feel free to skip this tutorial if you don’t have a device handy. Orientation The orientationchange event fires when …

Read More »
Keyboard Events

Keyboard Events – Advanced JavaScript Tutorial

It’s time to take a look at keyboard events. Another popular feature of JavaScript is the capability to detect which keys were pressed and how they were pressed. Let’s first update our document to this. [crayon-5a36930d2b572188295477/] Sweet! Now, let’s clear up the script and add this bit of code. [crayon-5a36930d2b583730334295/] The first kind of event is the keydown event. This …

Read More »
Mouse Events

Mouse Events – Advanced JavaScript Tutorial

Keep track of how the mouse interacts with the web page. It is the primary device for navigation after all. Whenever mouse events occur, you’re passed in a lot of information as to where the mouse is located or what is also happening with the mouse. Let’s take a look at how this works. Coordinates We’re going to keep our …

Read More »
UI Events

UI Events – Advanced JavaScript Tutorial

UI events are events that aren’t specific to the document, but the window object. These events fire when something happens to the browser or window. Loading Events Loading events fire when the window has loaded all scripts, images, files and styles. There are also unloading events for when the user leaves the page. Update your document to this. [crayon-5a36930d2c6b2751184285/] Let’s …

Read More »
Event Object

Event Object – Advanced JavaScript Tutorial

The event object is passed into your function whenever an event occurs. This object contains information about the event and even allows you to change how the event phases flow. We’ll be working with our previous example. Update your script to this. [crayon-5a36930d2cdd2941062829/] Our functions have been updated so that we can reference the event object. The event parameter will …

Read More »
Event Handlers

Event Handlers – Advanced JavaScript Tutorial

If you’ve seen my events tutorial in my JavaScript basics tutorial series, then you already know how to use events. There’s another way of using events with event handlers. Before we begin, let’s update the <body> tags in our document to this. [crayon-5a36930d2d82a849740147/] We just have a simple button in our document with the ID btn. To add an event, …

Read More »
Data Attribute

Data Attribute – Advanced JavaScript Tutorial

HTML5 is fairly new and it’s slowly being adopted by all web browsers today. A special feature of HTML5 is the ability to define custom data attributes. A data attribute is your own attribute that can contain information about an element. Let’s update our document to this. [crayon-5a36930d2e289406041970/] To create a data attribute, you simply create an attribute with the …

Read More »
Selectors API

Selectors API – Advanced JavaScript Tutorial

The selectors API is a simpler way to grab elements by using CSS queries. If you recall, you can change the styles of an element using CSS. Here’s an example of how you would do so. [crayon-5a36930d2e817605224162/] To grab an element in general, you just type in the tag name. To grab an element with an ID, you type a …

Read More »
Navigator Object

Navigator Object – Advanced JavaScript Tutorial

The navigator object allows you to grab information about the browser and visitor’s computer. You can grab the browser name, plugins, OS, language, etc. Properties Clear your script and add this bit of code. [crayon-5a36930d2f4ba234049885/] The navigator object is pretty tricky. Even though the navigator object has been around since Netscape Navigator 2, the properties and methods are supported in …

Read More »
Location Object

Location Object – Advanced JavaScript Tutorial

The location object contains information about the current URL you’re visiting. It can give you helpful information such as the port number, whether or not the site is using SSL and even allows you to redirect the user. Properties Clear your script and add this bit of code. [crayon-5a36930d2f9dc602112266/] There are a couple of properties of the location object, but …

Read More »
Timing Events

Timing Events – Advanced JavaScript Tutorial

There are 2 kinds of timing events. There’s one with timeouts and another with intervals. Timeouts execute once after a certain amount of time has passed by. Intervals execute repeatedly after a certain amount of time has passed by. Timeouts Clear your script and add this bit of code. [crayon-5a36930d30070816439394/] To create a timeout you use the setTimeout() method. This …

Read More »
Window Object

Window Object – Advanced JavaScript Tutorial

There’s one object to rule them all. That is the global object. Every variable, object and function is part of the global object. The global object can’t be accessed directly. However, most JavaScript host environments create an object that act as the global object. For browsers, this is known as the window object. Let’s take a look at how the …

Read More »

Closures – Advanced JavaScript Tutorial

Closures allow you to take your JavaScript skills to the next level. Closures are used in almost every JavaScript code you’ve ever seen. You’ve probably ended up using it without knowing it. So, what are closures? A closure is a function inside a function. So, what’s so special about this? Well, you can actually access the variables outside of the …

Read More »
Recursive Functions

Recursive Functions – Advanced JavaScript Tutorial

We’re going to stop talking about object oriented programming for now. Let’s focus on functions. There’s a thing called recursive functions. It’s just a function that calls on itself until a condition has been met. Almost like a loop. Setting Up The Script Clear your script and add this bit of code. [crayon-5a36930d31a62496769780/] If you don’t know what factorials are, …

Read More »
Want to learn how to create your own custom WordPress plugins and themes? Check out my course!
Get 93% off my course. You'll also learn how to integrate WooCommerce and BuddyPress into your projects. This is a limited time offer
Yes, I would like to get 93% off your course!
No Thanks!