// //Notes: //Requires that the element getting the shadow have a fixed height and width defined in the html, and that both a left and right or top and bottom reference be provided. //Alternatively a shadow-class="xxx" attribute can be supplied that references a css class with those properties. The css class must have width and height that includes the contents, border, and shadow size (10px x 10px). // Example:
...
// (function($) { $.fn.buildShadow = function() { for(var index = 0; index < this.length; index++) { var next = $(this[index]); //Prevent a double shadow.// if(!next.parent().data('is-shadow')) { //
//Wrap the image with a div and leave space for shadows.// next.wrap(function(index) { $next = $(next); var p = $next.css('position'); var f = $next.css('float'); var w = parseInt($next.css('width')); var h = parseInt($next.css('height')); var classes = $next.attr('shadow-class'); var c = $next.css('clear'); var padT = parseInt($next.css('padding-top')); var padR = parseInt($next.css('padding-right')); var padB = parseInt($next.css('padding-bottom')); var padL = parseInt($next.css('padding-left')); var marT = $next.css('margin-top'); var marR = $next.css('margin-right'); var marB = $next.css('margin-bottom'); var marL = $next.css('margin-left'); var borL = parseInt($next.css('border-left-width')); var borR = parseInt($next.css('border-right-width')); var borT = parseInt($next.css('border-top-width')); var borB = parseInt($next.css('border-bottom-width')); var html; html = "
"); }); next.parent().data('is-shadow', true); } } return this; } })(jQuery);