Skip to content

Instantly share code, notes, and snippets.

@nola
nola / tweenmax-scroll
Last active August 5, 2018 05:47
Calculate percentage of scroll Then uses tweenmax callbacks to continue the animation
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.10.1/TweenMax.min.js"></script>
<script>
$(function(){
@nola
nola / mousePos
Created July 31, 2013 18:33
mousePosition
var mousePos;
var lastMousePos = {x:0, y:0};
function initPanning () {
//TweenMax.ticker.addEventListener("tick", doPanning);
}
var moveRange = 20;
var halfRange = moveRange/2;
function doPanning () {
if ( !!mousePos && (lastMousePos.x != mousePos.x || lastMousePos.y != mousePos.y) ) {
@nola
nola / scrollto percentage of page
Last active December 20, 2015 11:39
use tweenmax and the scrollto plugin to scroll to a percentage of the page
<!DOCTYPE html>
<html>
<head>
<title>ScrollTo Tester</title>
<style>
body{
margin: 0px;
overflow-x: hidden;
}
@nola
nola / find-replace-ahref
Last active December 20, 2015 11:39
Find a link on a page based on the href="", then replace it with another value.
$('a').each( function(i, ele){
if( !!ele.href.match("/site.com") ){
ele.href = ele.href.replace("site.com" , "staging.site.com" );
}
});
/**
* @author Remy Sharp
* @url http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
*/
(function ($) {
$.fn.hint = function (blurClass) {
if (!blurClass) {
blurClass = 'blur';
@nola
nola / gist:6128814
Last active December 20, 2015 12:09
hint
/**
* @author Remy Sharp
* @url http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
*/
(function ($) {
$.fn.hint = function (blurClass) {
if (!blurClass) {
blurClass = 'blur';
@nola
nola / test3.html
Created August 2, 2013 20:18
Spinning Boxes
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.10.1/TweenMax.min.js"></script>
<script>
$(function(){
@nola
nola / geo-location
Last active December 20, 2015 18:29
Google maps html5 geolocation
<script>
$(function(){
var startingLocation;
var destination1544 = new google.maps.LatLng(30.439112, -84.257061);
var destination2020 = new google.maps.LatLng(30.440659, -84.318076);
navigator.geolocation.getCurrentPosition(function (position){
//lat and long
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
startingLocation = latitude + "," + longitude;
@nola
nola / conditional
Created August 8, 2013 18:17
body - conditional
<!--[if lte IE 8 ]>
<body class="ie8">
<![endif]-->
<!--[if IE 9 ]>
<body class="ie9">
<![endif]-->
<!--[if gt IE 9]><!-->
<body class="no-js">
<!--<![endif]-->