| 30 | | //Append smooth corners |
| 31 | | $('<div class="fx-shadow-color fx-shadow-layer-1"></div>').css({ position: 'absolute', opacity: options.opacity-0.05, left: 5+options.offset, top: 5+options.offset, width: baseWidth+1, height: baseHeight+1 }).appendTo(shadow); |
| 32 | | $('<div class="fx-shadow-color fx-shadow-layer-2"></div>').css({ position: 'absolute', opacity: options.opacity-0.1, left: 7+options.offset, top: 7+options.offset, width: baseWidth, height: baseHeight-3 }).appendTo(shadow); |
| 33 | | $('<div class="fx-shadow-color fx-shadow-layer-3"></div>').css({ position: 'absolute', opacity: options.opacity-0.1, left: 7+options.offset, top: 7+options.offset, width: baseWidth-3, height: baseHeight }).appendTo(shadow); |
| 34 | | $('<div class="fx-shadow-color fx-shadow-layer-4"></div>').css({ position: 'absolute', opacity: options.opacity, left: 6+options.offset, top: 6+options.offset, width: baseWidth-1, height: baseHeight-1 }).appendTo(shadow); |
| | 34 | // Get z-index |
| | 35 | zIndex = parseInt($element.css("zIndex")) || 0; |
| 36 | | //Add color |
| 37 | | $("div.fx-shadow-color", shadow).css("background-color", options.color); |
| | 37 | // Append smooth corners |
| | 38 | $('<div class="fx-shadow-color fx-shadow-layer-1"></div>').css({ position: 'absolute', opacity: options.opacity - 0.05, left: options.offset, top: options.offset, width: baseWidth + 1, height: baseHeight + 1 }).appendTo($shadow); |
| | 39 | $('<div class="fx-shadow-color fx-shadow-layer-2"></div>').css({ position: 'absolute', opacity: options.opacity - 0.10, left: options.offset + 2, top: options.offset + 2, width: baseWidth, height: baseHeight - 3 }).appendTo($shadow); |
| | 40 | $('<div class="fx-shadow-color fx-shadow-layer-3"></div>').css({ position: 'absolute', opacity: options.opacity - 0.10, left: options.offset + 2, top: options.offset + 2, width: baseWidth - 3, height: baseHeight }).appendTo($shadow); |
| | 41 | $('<div class="fx-shadow-color fx-shadow-layer-4"></div>').css({ position: 'absolute', opacity: options.opacity, left: options.offset + 1, top: options.offset + 1, width: baseWidth - 1, height: baseHeight - 1 }).appendTo($shadow); |
| 39 | | //Determine the stack order (attention: the zIndex will get one higher!) |
| 40 | | if(!cur.css("zIndex") || cur.css("zIndex") == "auto") { |
| 41 | | var stack = 0; |
| 42 | | cur.css("position", (cur.css("position") == "static" ? "relative" : cur.css("position"))).css("z-index", "1"); |
| 43 | | } else { |
| 44 | | var stack = parseInt(cur.css("zIndex")); |
| 45 | | cur.css("zIndex", stack+1); |
| 46 | | } |
| | 43 | // Add color |
| | 44 | $("div.fx-shadow-color", $shadow).css("background-color", options.color); |
| 48 | | //Copy the original z-index and position to the clone |
| 49 | | //alert(shadow); If you insert this alert, opera will time correctly!! |
| 50 | | shadow.css({ |
| 51 | | position: "absolute", |
| 52 | | zIndex: stack, |
| 53 | | left: position.left, |
| 54 | | top: position.top, |
| 55 | | width: baseWidth, |
| 56 | | height: baseHeight, |
| 57 | | marginLeft: cur.css("marginLeft"), |
| 58 | | marginRight: cur.css("marginRight"), |
| 59 | | marginBottom: cur.css("marginBottom"), |
| 60 | | marginTop: cur.css("marginTop") |
| | 46 | // Set zIndex +1 and make sure position is at least relative |
| | 47 | // Attention: the zIndex will get one higher! |
| | 48 | $element |
| | 49 | .css({ |
| | 50 | zIndex: zIndex + 1, |
| | 51 | position: ($element.css("position") == "static" ? "relative" : "") |
| | 52 | }); |
| | 53 | |
| | 54 | // Copy the original z-index and position to the clone |
| | 55 | // alert(shadow); If you insert this alert, opera will time correctly!! |
| | 56 | $shadow.css({ |
| | 57 | position: "absolute", |
| | 58 | zIndex: zIndex, |
| | 59 | top: position.top+"px", |
| | 60 | left: position.left+"px", |
| | 61 | width: baseWidth, |
| | 62 | height: baseHeight, |
| | 63 | marginLeft: $element.css("marginLeft"), |
| | 64 | marginRight: $element.css("marginRight"), |
| | 65 | marginBottom: $element.css("marginBottom"), |
| | 66 | marginTop: $element.css("marginTop") |
| 64 | | function rearrangeShadow(el,sh) { |
| 65 | | var $el = $(el); |
| 66 | | $(sh).css($el.position()); |
| 67 | | $(sh).children().css({ height: $el.outerHeight()+"px", width: $el.outerWidth()+"px" }); |
| 68 | | } |
| | 70 | if ( options.monitor ) { |
| | 71 | function rearrangeShadow() { |
| | 72 | var $element = $(this), $shadow = $element.next(); |
| | 73 | // $shadow.css( $element.position() ); |
| | 74 | $shadow.css({ |
| | 75 | top: parseInt($element.css("top")) +"px", |
| | 76 | left: parseInt($element.css("left")) +"px" |
| | 77 | }) |
| | 78 | $(">*", $shadow).css({ height: this.offsetHeight+"px", width: this.offsetWidth+"px" }); |
| | 79 | } |
| 70 | | if($.browser.msie) { |
| 71 | | //Add dynamic css expressions |
| 72 | | shadow[0].style.setExpression("left","parseInt(jQuery(this.previousSibling).css('left'))+'px' || jQuery(this.previousSibling).position().left"); |
| 73 | | shadow[0].style.setExpression("top","parseInt(jQuery(this.previousSibling).css('top'))+'px' || jQuery(this.previousSibling).position().top"); |
| 74 | | } else { |
| 75 | | //Bind events for good browsers |
| 76 | | this.addEventListener("DOMAttrModified",function() { rearrangeShadow(this,shadow); },false); |
| | 81 | // Attempt to use DOMAttrModified event |
| | 82 | $element.bind("DOMAttrModified", rearrangeShadow); |
| | 83 | |
| | 84 | // Use expressions if they exist (IE) |
| | 85 | if( $shadow[0].style.setExpression ) { |
| | 86 | $shadow[0].style.setExpression("top" , "parseInt(this.previousSibling.currentStyle.top ) + 'px'"); |
| | 87 | $shadow[0].style.setExpression("left", "parseInt(this.previousSibling.currentStyle.left) + 'px'"); |
| | 88 | } |