Skip to content

Instantly share code, notes, and snippets.

amycheng / inView
Created Aug 22, 2013
a javascript function to check if a html element is in view
View inView
function inView(el){
//check if a DOM element is in view
var scrollDistance=document.body.scrollTop;
if (scrollDistance>=el.offsetTop&&scrollDistance<el.offsetHeight+el.offsetTop) {
return true;
return false;
amycheng / cookie.js
Created May 10, 2013
methods for creating/reading/erasing cookies via JS
View cookie.js
amycheng / transitionEnd.js
Created Apr 30, 2013
a simple jQuery plugin for creating callbacks for CSS3 transitions
View transitionEnd.js
$.fn.transitionEnd = function(callback) {
//plugin for detecting the end of a transition and then doing a callback
$(this).one('webkitTransitionEnd otransitionend msTransitionEnd transitionend',
function(e) {
if (typeof callback == 'function') {;
amycheng / placeholderfallback
Created Jan 29, 2013
polyfill for placeholder
View placeholderfallback
$(function() {
function isPlaceholderSupported() {
var input = document.createElement("input");
return ('placeholder' in input);
var placeholdersupport = isPlaceholderSupported();
if (placeholdersupport == false) {
// If there is no placeholder support,
amycheng / cleanFormJS.js
Created Oct 23, 2012
cleanest jQuery I've ever writtern
View cleanFormJS.js
var $_this= $(this);