This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add class | |
DOMElement.className += " one"; | |
// Example: | |
// var el = document.body; | |
// el.className += " two" | |
// Remove class | |
function removeDOMClass(element, className) { | |
var oldClasses = element.className, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var walkPath = './'; | |
var walk = function (dir, done) { | |
fs.readdir(dir, function (error, list) { | |
if (error) { | |
return done(error); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI().use('node', 'anim', function (Y) { | |
Y.on('domready', function () { | |
(function () { | |
Y.one('body').delegate('click', function (e) { | |
e.preventDefault(); | |
var anchor = e.currentTarget.getAttribute('href'); | |
var scrollAnim = new Y.Anim({ | |
node: Y.one(Y.UA.gecko || Y.UA.ie || !!navigator.userAgent.match(/Trident.*rv.11\./) ? 'html' : 'body'), | |
to: { | |
scrollTop : Y.one(anchor).getY() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For all images. | |
var allImages = document.querySelectorAll('img[data-src]'); | |
for (var i = 0; i < allImages.length; i++) { | |
ImageLoader.load(allImages[i]); | |
} | |
// For a single image. |