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
// Plugin to get query params as an object | |
jQuery.extend({ | |
getQueryParameters : function(str) { | |
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0]; | |
} | |
}); | |
// EXAMPLE | |
// http://codepen.io/chriscoyier/pen/uszCr?lunch=sandwich&dinner=stirfry | |
var queryParams = $.getQueryParameters(); |
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
// Requires underscore or lodash for isUndefined() | |
var $cache = {}; | |
/** | |
* Returns the page title element and will set the page title element when it doesn't exist | |
* @param {String} selector | |
* @returns {jQuery} | |
*/ | |
getElement: function getElement(selector) { | |
if (typeof selector !== 'string') { |
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
/** | |
* When !mobile and !facebook then redirect to facebook app/tab | |
* javascript mobile browser detect from http://detectmobilebrowsers.com/ (modified below) | |
* Regex updated: 28 February 2012 | |
*/ | |
(function(a,window,url){ | |
ismobile = /android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( |
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
// ScrollTo top of an element | |
$('html, body').animate({scrollTop: $('#my-element').offset().top}, 600, 'linear'); | |
// ScrollTo and center the element | |
$('html, body').animate({ | |
scrollTop: parseInt($('#my-element').offset().top) - ($(window).height() / 2) + ($('#my-element').height() / 2), | |
scrollLeft: parseInt($('#my-element').offset().left) - ($(window).width() / 2) + ($('#my-element').width() / 2) | |
}, 600, 'linear'); |
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Ring Pulsers</title> | |
<style type="text/css" media="screen"> | |
.marker { | |
left: 150px; | |
height: 100px; | |
position: absolute; |
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
// Using media queries in Sass with ESRG Grid Generator (https://github.com/dfcb/extra-strength-responsive-grids) | |
@import 'grid.generator.scss' // (https://github.com/dfcb/extra-strength-responsive-grids/blob/master/css/_grid.generator.scss) | |
// Media query mixin used below (should live in another file) | |
@mixin mq($media_query) { | |
@media ($media_query) { @content; } | |
} | |
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
/** | |
* FIXED and FLUID RATIOs | |
* http://voormedia.com/blog/2012/11/responsive-background-images-with-fixed-or-fluid-aspect-ratios | |
*/ | |
/** | |
* FIXED RATIO | |
<div class="column"> | |
<figure class="fixedratio"></figure> |
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
data:text/html,<html contenteditable> |
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
// strip-units() | |
// Remove units from a Sass value with units (em, px, etc.) | |
// http://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass#answer-12335841 | |
// EXAMPLE | |
// strip-units($my-var); | |
@function strip-units($number) { | |
@return $number / ($number * 0 + 1); | |
} | |
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://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/ */ | |
overflow: hidden; | |
text-indent: 100%; | |
white-space: nowrap; |
OlderNewer