Skip to content

Instantly share code, notes, and snippets.

@ludder
ludder / ios-hacks.js
Created December 6, 2012 17:27
iOS hacks
/*! A fix for the iOS orientationchange zoom bug.
Script by @scottjehl, rebound by @wilto.
MIT / GPLv2 License.
Source: https://github.com/scottjehl/iOS-Orientationchange-Fix
Explanation: http://adactio.com/journal/4470/
*/
// No code, check source above
@ludder
ludder / slideDown.js
Created December 6, 2012 17:25
Vanilla JavaScript slideUp and slideDown functions
/*
Element to slide gets the following CSS:
max-height: 0;
opacity: 0;
overflow: hidden;
transition: max-height 0.4s ease 0s;
*/
/**
* Like jQuery's slideDown function - uses CSS3 transitions
@ludder
ludder / getParentByTagName.js
Created November 9, 2012 11:36
getParentByTagName - Get parent node for given tagname
/**
* Get parent node for given tagname
* @param {Object} node DOM node
* @param {String} tagname HTML tagName
* @return {Object} Parent node
*/
function getParentByTagName(node, tagname) {
var parent;
if (node === null || tagname === '') return;
parent = node.parentNode;