Created
January 19, 2010 09:02
-
-
Save elliottkember/280790 to your computer and use it in GitHub Desktop.
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
// Thanks to Joshua Hatfield (@fjhat) for the pluginizing! | |
(function($){ | |
$.fn.ek3d = function(options) { | |
var defaults = { | |
strength: 5, | |
hex: '#aaaaaa' | |
}; | |
var options = $.extend(defaults, options); | |
$().mousemove(function(e) { | |
$('*').each(function(){ | |
offset = $(this).offset(); | |
x = (e.pageX - (offset.left + parseInt($(this).css('width')) /2)) / 100; | |
y = (e.pageY - (offset.top + parseInt($(this).css('height')) /2)) / 100; | |
var ek3d_css; | |
if($.browser.msie) | |
ek3d_css = { 'filter' : 'dropshadow(color='+ options.hex +' ,offX='+ -(x)+'px,offY='+ -(y)+'px,'+ options.strength +'px)' } | |
else | |
ek3d_css = { 'text-shadow' : options.hex +' '+ -(x)+'px ' + -(y)+'px ' + options.strength+'px' } | |
$(this).css(ek3d_css); | |
}); | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment