Last active
August 29, 2015 14:03
-
-
Save anikets/8b8ce40fbcb4ab5d138f to your computer and use it in GitHub Desktop.
Behaviour for Jalousie Window
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 xc, yc; // X and Y coordinates of the mouse pointer. | |
// Change perspective origin as the mouse pointer moves. | |
document.body.addEventListener( 'mousemove', function( event ) { | |
// Chrome returns event.x and event.y whereas Firefox returns | |
// eventclientX and eventClientY. | |
'x' in event ? xc = event.x : xc = event.clientX; | |
'y' in event ? yc = event.y : yc = event.clientY; | |
document.body.setAttribute('style', 'perspective-origin:' + xc + 'px ' + yc + 'px;' + '-webkit-perspective-origin-x:' + xc + 'px; -webkit-perspective-origin-y:' + yc + 'px' ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment