Skip to content

Instantly share code, notes, and snippets.

@elliottkember
Created January 19, 2010 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliottkember/280790 to your computer and use it in GitHub Desktop.
Save elliottkember/280790 to your computer and use it in GitHub Desktop.
// 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