First create global variables (in functions.php or as a mu-plugin):
<?php
/*
* CUSTOM GLOBAL VARIABLES
*/
function wtnerd_global_vars() {
<!DOCTYPE html> | |
<meta charset=utf-8 /> | |
<title>hi</title> | |
<style> | |
</style> | |
<div></div> |
// Create the test | |
var pixelRatio = (window.devicePixelRatio >= 1.5) ? "high" : "normal"; | |
.. | |
// Pass it along through GA | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']); | |
// --- IMPORTANT LINE! | |
// params: event method, custom variable slot, variable name, variable value, scope level |
(function($,sr){ | |
// debouncing function from John Hann | |
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ | |
var debounce = function (func, threshold, execAsap) { | |
var timeout; | |
return function debounced () { | |
var obj = this, args = arguments; | |
function delayed () { |
<figure class="quote"> | |
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote> | |
</figure> |
// http://jasonwyatt.tumblr.com/post/10481498815/how-to-correctly-debounce-a-javascript-function | |
function debounce(fn, debounceDuration) | |
{ | |
debounceDuration = debounceDuration || 100; | |
return function(){ | |
if(!fn.debouncing){ | |
var args = Array.prototype.slice.apply(arguments); | |
fn.lastReturnVal = fn.apply(window, args); | |
fn.debouncing = true; |
First create global variables (in functions.php or as a mu-plugin):
<?php
/*
* CUSTOM GLOBAL VARIABLES
*/
function wtnerd_global_vars() {
addEventListener( | |
'scroll', | |
function() { | |
var i, | |
img, | |
rect, | |
images = document.querySelectorAll('[lazyload-src]'); | |
if ( ! images.length ) { | |
return; |
Let’s leave aside, for now, the fact that you’ve changed web standards. You’ve been a participant in the first time—in the history of the web, far as I know—that the web development community has taken a feature from an initial proposal to the funding of an honest-to-God native implementation.
Instead, I want you to focus on this: say only ten developers use a native responsive images solution to reduce the weight of just one page apeice by only 500kb, and each of those pages has a barely-significant 5,000 hits per month: those users have been saved almost 24GB of data. A thousand pages saving 500kb apeice, and we’ve saved users an entire terabyte in a month. Now expand that to the entire industry: every web developer; every hit on every page that would otherwise carry with it a huge, wasteful image request, saving megabytes at a time. To those users, the only change is that the web is faster, less expensive, more accessible. For those users, the web is just better.
In helping make the picture
element
Answering the Front-end developer JavaScript interview questions to the best of my ability.
Sometimes you need to delegate events to things.
this
works in JavaScriptThis references the object or "thing" defined elsewhere. It's like "hey, thing I defined elsewhere, I'm talkin' to you."
Fast 9 Jahre und nahezu 3 Millionen Downloads später ist Schluss.
Schluss mit WordPress.
Für mich geht ein Lebensabschnitt zu Ende. Ein Lebensabschnitt, der unendlich viel Erfahrung, Learnings und Spaß mit sich brachte. Ein Lebensabschnitt, der aber unendlich viel Zeit, Nerven und Motivation mit sich nahm. Doch der Wille zählt und ich hoffe stark, dass meine Software und mein Engagement die WordPress-Community ein Stückchen besser, qualitativer gemacht haben.