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
/* ## BASIC USAGE ## */ | |
$('#gallery img').galleryFocus(); | |
/* ## OPTIONS ## */ | |
$('#gallery img').galleryFocus({ | |
// 'radius' - default: 400 - set the source radius size | |
'radius': 800, |
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
<script type="text/javascript"> | |
// Toggle the .rotate class on all demo kitties in order | |
// with a delay of 200ms each step | |
$('#demo1 img').eachStep(200, function(i, el, duration){ | |
$(el).toggleClass('rotate'); | |
}); | |
</script> | |
<div id="demo1"> | |
<img src="http://placekitten.com/101/80"> |
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
$('img').each(function(i, el){ | |
// Add the class .rotate to all images at once | |
$(this).addClass('rotate'); | |
}); |
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 the class '.rotate' to every image in order | |
$('img').each(function(i, el) { | |
window.setTimeout(function(){ | |
$(el).addClass('animate'); | |
}, 400 * i); | |
}); |
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
<script type="text/javascript"> | |
var collection = [ | |
'#777777', '#444444', '#222222', '#249adb', | |
'#fc41a9', '#ffe200', '#faa653', '#007791' | |
]; | |
$.eachStep(collection, '600', function(key, val, duration){ | |
// each step of the collection animate the .demo2-box backgroundColor | |
// (requires the jquery.color plugin) | |
$('.demo2-box').animate({'backgroundColor': val}, duration); |
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
/** | |
* Get the names of the arguments of any function | |
*/ | |
var getFnArgs = function(fn){ | |
var args = fn.toString().lines()[0]; | |
return args.replace('function (', '').replace('){', '').split(', '); | |
}; | |
// usage |
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
/** | |
* Random numbers, 3 ways. Usage: | |
* - random() : returns a random integer | |
* - random(30) : returns a random integer from 0 to 30 | |
* - random(20, 50) : returns a random integer from 20 to 50 | |
*/ | |
var random = function() { | |
var f = Math.floor, r = Math.random, a = arguments; | |
switch(a.length){ | |
case 0: return f(r()); break; |
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
// Mortal Kombat Character Names | |
// - encoded in js array format from the list on wikipedia: | |
// - http://en.wikipedia.org/wiki/List_of_Mortal_Kombat_characters | |
var names = [ | |
'Goro', | |
'Johnny Cage', | |
'Kano', | |
'Liu Kang', | |
'Raiden', | |
'Reptile', |
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
/** | |
* file: images.json | |
*/ | |
{ | |
"images": [ | |
{"title": "Image One", "url": "image1.jpg", "rating": "3.5"}, | |
{"title": "Image Two", "url": "image2.jpg", "rating": "1"}, | |
{"title": "Image Three", "url": "image3.jpg", "rating": "5"} | |
] | |
} |
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
/** | |
* json2xml - Convert an xml2js JSON object back to XML | |
* | |
* @author Derek Anderson | |
* @copyright 2011 Media Upstream | |
* @license MIT License | |
* | |
* Usage: | |
* | |
* json2xml({"Foo": "@": { "baz": "bar", "production":"true" }}, "Test", function(xml){ |
OlderNewer