RSSAmplifier

Blog

Mark Dalgleish

markdalgleish.comRSS feed ↗16 posts

Latest posts

Web Components: Why You're Already An Expert

Web Components are going to fundamentally change the nature of HTML. At first glance, they may seem like a complicated set of new technologies, but Web Components are built around a simple premise. Developers should be free to act like browser vendors, extending the vocabulary of HTML itself. If you re intimidated by these new technologies or haven t experimented with them yet, this post has a…

Using Promises in AngularJS Views

One of the lesser known yet more surprisingly powerful features of AngularJS is the way in which it allows promises to be used directly inside views. To better understand the benefits of this feature, we ll first migrate a typical callback-style service to a promise-based interface. Working with callbacks For now we ll sidestep a discussion on the advantages of promises compared to callbacks, and…

Testing jQuery Plugins Cross-Version with Grunt

The jQuery team have made the tough, but inevitable decision to stop supporting IE8 and below as of jQuery v2.0 , while maintaining v1.9 as the backwards compatible version for the forseeable future. In the world of modern, evergreen and mobile browsers, this was a necessary move to ensure jQuery stays relevant. Of course, this split leaves plugin authors with a bit more responsibility. Where…

A Touch of Class: Inheritance in JavaScript

The object-oriented features of JavaScript, such as constructors and prototype chains, are possibly the most misunderstood aspects of the language. Plenty of people who have been working full time with JavaScript still struggle with these concepts, and I argue that this is purely a result of its confusing, Java-style syntax. But it doesn t have to be this way. Hiding beneath the new keyword is a…

Mobile Parallax with Stellar.js

Parallax effects can be an extremely effective way to engage users during the simple act of scrolling. What is normally a simple process of moving static content along the screen can become an act of moving through a makeshift, HTML world. While the effect can certainly be abused, when applied with a light, elegant touch, it can breathe new life into your site. Unfortunately this effect is…

Test-Driven Node.js Development with Grunt

One of the great things about working in a Node.js environment is that it encourages you to break your work down into discrete modules. Separating your work into smaller files is a good first step, but publishing to npm is so simple that creating small modules for others to share is a great way to give back to the community. When writing small modules that adhere to the Unix philosophy of small…

Getting Closure in JavaScript

On May 23-24 2012, the first Web Directions Code event was held in Melbourne. With twenty talks from local and international presenters, including Faruk Ates and Ryan Seddon ( Modernizr ), Divya Manian ( HTML5 Boilerplate , HTML5 Readiness ), Dmitry Baranovskiy ( Raphael ), Dave Johnson ( Phonegap ) and, of course, the inimitable John Allsopp , one of the masterminds behind Web Directions. I was…

Using 3D CSS Transitions with Fathom.js

If you ve started making presentations using the browser, your work might still resemble a standard Keynote or Powerpoint presentation. The main benefit of creating presentations in HTML is that you have all the power of modern browsers available to you. This article will focus on just one aspect of this: CSS 3D transforms and transitions. Presenting Fathom.js Fathom.js , the jQuery-based…

$.html5data - Creating Highly Configurable jQuery Plugins - Part 2

In my previous post on allowing users of your plugin to customise it in many different ways, I briefly touched on the use of HTML5 data attributes. If you want to provide a hash of settings from your markup, one way to do this is by writing an object literal as the value of a data attribute: 1 <div data-myplugin= '{foo:"true", bar: "10"}' ></div> Even though this works, I react the same way to an…

Random Hacks of Kindness #3: One Week Later

RHoK #3 finished last Sunday and this week has been a busy week, I figured I m overdue a rundown of how the weekend went and what I personally got out of it. If you haven t heard of the event before, according to the official RHoK website , Random Hacks of Kindness is a community of innovation focused on developing practical open source solutions to disaster risk management and climate change…

Creating Highly Configurable jQuery Plugins

When writing jQuery plugins, you have many options for how you might structure your code. Depending on the complexity of your plugin, you ll probably want to allow users of your plugin to exert some level of control over how it operates. There are a few ways to do this, but I like to ensure that there are many ways even within a single plugin to allow the greatest level of flexibility. Let s start…

jQuery Selector for HTML5 Input Types

With HTML5 comes a new set of input types, including search and date types. The problem is that currently most of these are currently treated as textboxes and the following selectors won t pick them up: 1 2 $ ( 'input[type=text]' ); $ ( 'input:text' ); Obviously, you could select just the type of input you like by substituting input[type=text] with input[type=search] , but if you need to attach…

$(document).ready() for jQuery Mobile

jQuery Mobile is a great framework for getting a polished mobile site up and running relatively quickly and easily. Due to the way that it injects pages into the DOM using Hijax , our usual techniques for running code against the current page using selectors that traverse the body no longer make sense. Basically, there isn t a $(document).ready(). It s for this very reason that we can t rely on…

tmpload - Asynchronous Template Loading and Caching for jQuery Templates

I m very pleased to announce the release of my new jQuery plugin, tmpload . It s no secret that I m a big fan of client-side templating and the official jQuery Templates (aka tmpl) plugin is really quite fantastic. I especially like the idea of templates in external files. Generally there are two ways that external templates are implemented: Including them in a script block, downloading them when…

Self-Executing Anonymous Functions

When learning JavaScript, with all the attention given to variables, functions, if statements, loops and event handlers, often little is done to educate you on how you might cleanly organise your code into a cohesive, structurally-sound whole. Let s take the following code for example: 1 2 3 4 5 6 7 8 var foo = 'Hello' ; var bar = 'World!' ; function baz (){ return foo + ' ' + bar ; } console .…

The Controversial Future of URLs

Most notably with upgrades to Twitter and Gawker, the use of #! , or hashbang, in a website s URL has come to the forefront of emerging front-end development trends. The feedback, even from those who consider themselves on the cutting edge, often lands on the negative side of the argument. It s been urged by many in the industry that the hashbang breaks the basic assumption of how a URL functions.…