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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
function deviceDetection() { | |
if( navigator.userAgent.match(/Android/i) | |
|| navigator.userAgent.match(/webOS/i) | |
|| navigator.userAgent.match(/iPhone/i) | |
|| navigator.userAgent.match(/iPad/i) | |
|| navigator.userAgent.match(/iPod/i) | |
|| navigator.userAgent.match(/BlackBerry/i) | |
|| navigator.userAgent.match(/Windows Phone/i)) { | |
device = 'mobile'; | |
} else { |
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 killScroll = false; | |
$(container).bind('scroll', function() { | |
if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight && killScroll == false) { | |
// whatever you want to do when bottom is reached | |
killScroll = true; | |
// to prevent more loading | |
setTimeout(function(){killScroll = false}, 2000); | |
} | |
} |
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
// to use: @include centerCenter; | |
// make sure the element has position: absolute, relative or fixed | |
@mixin centerCenter { | |
left: 50%; | |
top: 50%; | |
-webkit-transform: translate(-50%, -50%); | |
-ms-transform: translate(-50%, -50%); | |
transform: translate(-50%, -50%); | |
} |
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
$.rand = function(arg) { | |
if ($.isArray(arg)) { | |
return arg[$.rand(arg.length)]; | |
} else if (typeof arg === "number") { | |
return Math.floor(Math.random() * arg); | |
} else { | |
return 4; | |
} | |
} |
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 currentHeading = 0; | |
var newHeading = 0; | |
var heading = 0; | |
var headingCatchSmooth = 0; //catch up smoothly to the heading value; | |
var headingCatchSmoothSlowly = 0; | |
function updateFeet(){ | |
var diffAngle = heading - headingCatchSmooth; | |
//console.log("heading: "+ heading); |