This file contains 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 obj = {opacity:0}; | |
TweenLite.to(obj, 2, {opacity:0.5, onUpdate:report}); | |
function report() { | |
console.log(obj.opacity); | |
} |
This file contains 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 parent = { | |
get: function fn(){ | |
return this.val; | |
}, | |
val:42 | |
} | |
var child = Object.create(parent); | |
child.val = 3.14; |
This file contains 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
<div | |
id="socket" | |
class="hero" | |
data-speed="3" | |
data-scale-range="0.2" | |
data-from-x="0" | |
data-to-x="940" | |
data-from-y="200" | |
data-to-y="-300" | |
data-from-z="-100" |
This file contains 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 particle = $(".green-bar"); | |
function randNum( bit ){ | |
//TweenMax.fromTo(bit, 0.3+(Math.random()*0.5), {y:Math.floor(Math.random()*245) + 1, x:-500, rotationY:0, scale:(0.3+(Math.random()*0.8)), skewX:45, opacity:(0.01+(Math.random()*0.2))}, {rotationY:Math.floor(Math.random()*90), x:1000, ease:Linear.easeNone, transformOrigin:"50% 50%", onComplete:randNum, onCompleteParams:[bit] }, 0); | |
//TweenMax.fromTo(bit, 0.3+(Math.random()*2), {y:Math.floor(Math.random()*245) + 1, x:-500, rotationX:0, scale:(0.5+(Math.random()*1)), skewX:0, opacity:(0.01+(Math.random()*0.1))}, {rotationX:Math.floor(Math.random()*360), x:1000, skewX:20, ease:Linear.easeNone, transformOrigin:"50% 50%", onComplete:randNum, onCompleteParams:[bit] }, 0); | |
//TweenMax.to(bit, 0.01+(Math.random()*3), {y:(-1*(100)+(Math.random()*200)), opacity:(0.09+(Math.random()*0.1)), scale:(0.5+(Math.random()*1)), rotationY:360, rotationX:(0+(Math.random()*10)), ease:Linear.easeNone, transformOrigin:"50% 50% -1600", onComplete:ra |
This file contains 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
// PREVENT 'CONSOLE' ERRORS IN BROWSERS THAT LACK A CONSOLE. | |
(function (window){if(!(window.console&&window.console.log)){var noop=function(){};var methods=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","markTimeline","table","time","timeEnd","timeStamp","trace","warn"];var length=methods.length;var console=window.console={};while(length--)console[methods[length]]=noop}})(window); |
This file contains 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
<!-- Prevent FOUC (flash of unstyled content) - http://johnpolacek.com/2012/10/03/help-prevent-fouc/ --> | |
<style type="text/css"> | |
.no-fouc {display: none;} | |
</style> | |
<script type="text/javascript"> | |
document.documentElement.className = 'no-fouc'; | |
// add to document ready: $('.no-fouc').removeClass('no-fouc'); | |
</script> |
This file contains 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
// detect if mobile browser. regex -> http://detectmobilebrowsers.com | |
var isMobile = (function(a){return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01 |
This file contains 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
window.addEventListener('orientationchange', doOnOrientationChange); | |
function doOnOrientationChange(){ | |
if (window.orientation == -90 || window.orientation == 90) { | |
//alert('landscape'); | |
} else if (window.orientation == 0) { | |
//alert('portrait'); | |
} |
This file contains 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
if (!Modernizr.svg) { | |
var imgs = document.getElementsByTagName('img'); | |
var svgExtension = /.*\.svg$/ | |
var l = imgs.length; | |
for(var i = 0; i < l; i++) { | |
if(imgs[i].src.match(svgExtension)) { | |
imgs[i].src = imgs[i].src.slice(0, -3) + 'png'; | |
//console.log(imgs[i].src); | |
} | |
} |
This file contains 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
$('form').validate({ // initialize the plugin | |
rules: { | |
email: { | |
required: true, | |
email: true | |
} | |
}, | |
submitHandler: function (form) { | |
//alert('valid form submitted'); // for demo |
OlderNewer