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 poll = (function(){ | |
| var timer = 0; | |
| return function(callback, ms){ | |
| clearTimeout(timer); | |
| timer = setTimeout(callback, ms); | |
| }; | |
| })(); | |
| $(window).resize(function(){ | |
| // Poll the window.resize event every 25ms for changes and fire specific code. |
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
| // Poll element's distance from bottom of browser window. When element is visible, perform action. | |
| // I couldn't think of a better name, and YouBet rhymes with offset. Find + Replace if it bugs you. | |
| var poll = (function(){ | |
| var timer = 0; | |
| return function(callback, ms){ | |
| clearTimeout(timer); | |
| timer = setTimeout(callback, ms); | |
| }; | |
| })(); |
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
| function isMobile() { | |
| return (/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i).test(navigator.userAgent || navigator.vendor || window.opera); | |
| } |
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
| function skrollrInit() { | |
| if ( $(window).width() < 528 ) { | |
| footer.attr('data-end', 'height:750px;'); | |
| } | |
| else { | |
| footer.attr('data-end', 'height:560px;'); | |
| } | |
| $('html').removeClass('no-skrollr'); | |
| skrollr.init(); |
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
| function distanceToBottom() { | |
| var distanceToTop = $(window).scrollTop(); | |
| var windowHeight = $(window).height(); | |
| var documentHeight = $('html').height(); | |
| var distanceFromEnd = (documentHeight - (distanceToTop + windowHeight)); | |
| return distanceFromEnd; | |
| } |
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
| function youtubeGetID($url) { | |
| $url = explode('?v=', $url); | |
| return $url[1]; | |
| } |
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
| javascript:window.alert('You are in ' + (document.compatMode==='CSS1Compat'?'Standards':'Quirks') + ' mode.') |
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
| function vimeoEmbed($url) { | |
| $url = explode('vimeo.com/', $url); | |
| $firstPart = '//player.vimeo.com/video/'; | |
| $secondPart = '?title=1&byline=0&portrait=0&color=ebbe1e'; | |
| return $firstPart . $url[1] . $secondPart; | |
| } |
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
| function youtubeGetID($url) { | |
| $url = explode('?v=', $url); | |
| $embedURL = '//www.youtube.com/embed/' . $url[1]; | |
| return $embedURL; | |
| } |
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
| // More information at: | |
| // http://stackoverflow.com/questions/7988476/listening-for-youtube-event-in-javascript-or-jquery/7988536#7988536 | |
| function getFrameID(id){ | |
| var elem = document.getElementById(id); | |
| if (elem) { | |
| if(/^iframe$/i.test(elem.tagName)) return id; //Frame, OK | |
| // else: Look for frame | |
| var elems = elem.getElementsByTagName("iframe"); | |
| if (!elems.length) return null; //No iframe found, FAILURE |