Last active
August 29, 2015 14:26
-
-
Save data-doge/a16a57beb13c7cda3126 to your computer and use it in GitHub Desktop.
fun jQuery scripts, run on any site with jQuery
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 diglettUrl = "https://fc06.deviantart.net/fs70/f/2010/165/9/4/050___Diglett_by_cammarin.png"; | |
function initiateDiglettFuckdown () { | |
$('img').attr('src', diglettUrl); | |
$('a').text('DIGLETT'); | |
$('*').each(function(i, element) { | |
var width = $(element).width(); | |
$(element).css({ | |
'backgroundImage' : 'url(' + diglettUrl + ')', | |
'backgroundSize' : width / 10 | |
}); | |
}); | |
} | |
initiateDiglettFuckdown(); |
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 deg = 0; | |
var $body = $('body'); | |
var $elements = $('body *') | |
function rotate() { | |
requestAnimationFrame(rotate); | |
deg++; | |
$elements.css({ | |
'-webkit-transform' : 'rotate(' + deg + 'deg)' | |
}); | |
} | |
function initiateRotator () { | |
rotate(); | |
} | |
initiateRotator(); |
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 windowWidth = $(window).width(); | |
var windowHeight = $(window).height(); | |
function initiateScrambler () { | |
$(document).on('mousemove', function () { | |
scramble(); | |
}); | |
} | |
function scramble () { | |
$('body *').each(function (index, element) { | |
var position = randPosition(); | |
$(element).css({ | |
'position' : 'fixed', | |
'top' : position.y, | |
'left' : position.x | |
}); | |
}); | |
} | |
function randPosition () { | |
return { | |
x : Math.random() * windowWidth, | |
y : Math.random() * windowHeight | |
}; | |
} | |
initiateScrambler(); |
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 variance = 20; | |
var $body = $('body'); | |
function initiateShaker () { | |
$body.css({ | |
'position' : 'absolute' | |
}); | |
shake(); | |
} | |
function shake () { | |
requestAnimationFrame(shake); | |
var position = $body.position(); | |
var currentX = position.left; | |
var currentY = position.top; | |
$body.css({ | |
top : randCloseNumber(currentY, variance), | |
left : randCloseNumber(currentX, variance) | |
}); | |
} | |
function randCloseNumber (number, range) { | |
var sign = Math.random() > 0.5 ? 1 : -1; | |
return sign * Math.random() * range + number; | |
} | |
initiateShaker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment