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
//http://css-tricks.com/snippets/jquery/smooth-scrolling/ | |
$(function() { | |
$('a[href*=#]:not([href=#])').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') | |
|| location.hostname == this.hostname) { | |
var target = $(this.hash); | |
target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); | |
if (target.length) { |
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
/* http://css-tricks.com/snippets/css/clear-fix/ */ | |
.group:before, | |
.group:after { | |
content: ""; | |
display: table; | |
} | |
.group:after { | |
clear: both; | |
} |
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
function isElementInViewport(el) { | |
var rect = el.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || document. documentElement.clientHeight) && /*or $(window).height() */ | |
rect.right <= (window.innerWidth || document. documentElement.clientWidth) /*or $(window).width() */ | |
); | |
} |
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
/** | |
* Conserve aspect ratio of the orignal region. Useful when shrinking/enlarging | |
* images to fit into a certain area. | |
* | |
* @param {Number} srcWidth Source area width | |
* @param {Number} srcHeight Source area height | |
* @param {Number} maxWidth Fittable area maximum available width | |
* @param {Number} maxHeight Fittable area maximum available height | |
* @return {Object} { width, heigth } | |
*/ |
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 indexof for browsers that don't support it | |
if (!Array.prototype.indexOf) { | |
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { | |
"use strict"; | |
if (this == null) { | |
throw new TypeError(); | |
} | |
var t = Object(this); | |
var len = t.length >>> 0; | |
if (len === 0) { |
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
//http://james.padolsey.com/javascript/shuffling-the-dom/ | |
(function($){ | |
$.fn.shuffle = function() { | |
var allElems = this.get(), | |
getRandom = function(max) { | |
return Math.floor(Math.random() * max); | |
}, | |
shuffled = $.map(allElems, function(){ | |
var random = getRandom(allElems.length), |
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
/* modernizr-test.js | |
* Daniel Ott | |
* 3 March 2011 | |
* Custom Tests using Modernizr's addTest API | |
*/ | |
/* iOS | |
* There may be times when we need a quick way to reference whether iOS is in play or not. | |
* While a primative means, will be helpful for that. | |
*/ |
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
function getParameterByName(name) | |
{ | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regexS = "[\\?&]" + name + "=([^&#]*)"; | |
var regex = new RegExp(regexS); | |
var results = regex.exec(window.location.href); | |
if(results == null) | |
return ""; | |
else | |
return decodeURIComponent(results[1].replace(/\+/g, " ")); |
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
function abbrNum(number, decPlaces){ | |
//http://stackoverflow.com/questions/2685911/is-there-a-way-to-round-numbers-into-a-reader-friendly-format-e-g-1-1k | |
// 2 decimal places => 100, 3 => 1000, etc | |
decPlaces = Math.pow(10,decPlaces); | |
// Enumerate number abbreviations | |
var abbrev = [ "k", "m", "b", "t" ]; | |
// Go through the array backwards, so we do the largest first | |
for (var i=abbrev.length-1; i>=0; 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
#This is an H1 | |
Vivamus auctor condimentum porttitor. Morbi turpis ante, commodo eu aliquet at, posuere non enim. Pellentesque aliquet ornare velit, id mattis lectus finibus quis. Proin non dapibus felis. Etiam id lacus hendrerit, posuere ligula eget, maximus nisl. | |
##This is an H2 | |
Vivamus auctor condimentum porttitor. Morbi turpis ante, commodo eu aliquet at, posuere non enim. Pellentesque aliquet ornare velit, id mattis lectus finibus quis. Proin non dapibus felis. Etiam id lacus hendrerit, posuere ligula eget, maximus nisl. | |
###This is an H3 | |
Vivamus auctor condimentum porttitor. Morbi turpis ante, commodo eu aliquet at, posuere non enim. Pellentesque aliquet ornare velit, id mattis lectus finibus quis. Proin non dapibus felis. Etiam id lacus hendrerit, posuere ligula eget, maximus nisl. | |
####This is and H4 |
OlderNewer