This file contains hidden or 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
var i = 0; | |
var timer = setInterval(function(){ | |
// stuff | |
if(i === 5) { | |
clearInterval(timer); | |
console.log('callback'); // callback after some time | |
} | |
}, 200); |
This file contains hidden or 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
var oXhr; | |
oXhr = new XMLHttpRequest(); | |
oXhr.id = (new Date()).getTime(); | |
oXhr.onreadystatechange = function() { | |
if (oXhr.readyState === 4 && (oXhr.status === 200)) { | |
// code stuffs | |
console.log(this.id); | |
} |
This file contains hidden or 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
<!-- tk optimize // http://goo.gl/2A1IF7 --> | |
<script type = "text/javascript" > (function(e) { | |
var t = 3e3; | |
if (window.sessionStorage) { | |
if (sessionStorage.getItem("useTypekit") === "false") { | |
t = 0; | |
} | |
} | |
var n = { | |
kitId: "abcd1234", |
This file contains hidden or 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
const main = {}; | |
const updateScroll = () => { | |
main.winScroll = $(window).scrollTop(); | |
if (!main.winScrollMem) { | |
main.winScrollMem = 0; | |
} | |
if (main.winScroll > main.winScrollMem) { | |
main.winScrollDir = 'down'; | |
} else { | |
main.winScrollDir = 'up'; |
This file contains hidden or 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
const main = {}; | |
const inViewport = ($el) => { | |
let winTop = main.winScroll; | |
let winBtm = winTop + main.winHeight; | |
let $elTop = $el.offset().top; | |
let $elBtm = $elTop + $el.outerHeight(); | |
return $elBtm > winTop && $elTop < winBtm; | |
} | |
if (inViewport($el) === true) { |
This file contains hidden or 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
const main = {}; | |
const updateScroll = () => { | |
main.winScroll = $(window).scrollTop(); | |
}; | |
const parallaxLoad = () => { | |
const $someEl = $('.someEl'); | |
$someEl.each((i,el) => { | |
let $el = $(el); |
OlderNewer