Skip to content

Instantly share code, notes, and snippets.

@nosp4mSnippets
nosp4mSnippets / JS:getDocumentHeight
Created June 25, 2013 17:22
JS: get Document Height
function getDocHeight() {
var D = document;
return Math.max(
Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
Math.max(D.body.clientHeight, D.documentElement.clientHeight)
);
}
@nosp4mSnippets
nosp4mSnippets / finalevent.js
Created June 23, 2013 22:10
JS: wait final event
// Here's a modification of CMS's solution that can be called in multiple places in your code:
// Wait for final event example during resize
//
var waitForFinalEvent = (function () {
var timers = {};
return function (callback, ms, uniqueId) {
if (!uniqueId) {
uniqueId = "Don't call this twice without a uniqueId";
}
@nosp4mSnippets
nosp4mSnippets / gist:4252313
Created December 10, 2012 18:25 — forked from padolsey/gist:527683
JS: detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}