Skip to content

Instantly share code, notes, and snippets.

@hiro3
hiro3 / gist:2056865
Created March 17, 2012 09:00 — forked from padolsey/gist:527683
JavaScript: 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) {}
@hiro3
hiro3 / gist:3682327
Last active October 10, 2015 11:18
CSS3 hop effects
#point {
position:absolute;
width:8px;
height:8px;
margin:-4px 0 0 -4px;
background:-webkit-gradient(linear,left top,left bottom,from(#FFACCB),color-stop(0.5,#FF73A7),to(#FF5E99));
border-radius:4px;
box-shadow:0 2px 3px #333
}
#point.hop {
@hiro3
hiro3 / JS: Detect size and scroll
Created June 2, 2013 10:44
BackCompat = Back Compatible = 後方互換モードだとdocument.bodyをみないと値が取れないためrootを設定。
var root = (document.compatMode === "BackCompat") ? document.body : document.documentElement;
console.log([
root.clientHeight,//height of the visible area
root.clientWidth,//width of the visible area
root.scrollHeight,//document height including hidden(scroll) area
root.scrollWidth,//document width including hidden(scroll) area
window.pageYOffset || root.scrollTop,
window.pageXOffset || root.scrollLeft,
]);