Skip to content

Shadow Effect by JQuery

Here is the original object on which we are to make shadow effect.

Code of the object first:

    This is a paragraph in a div container.

        And

            this is a span text (white text on black background) within another paragraph
        .

And the following is what the object looks like:

This is a paragraph in a div container.

And this is a span text (white text on black background) within another paragraph .

Now we are going to make the shadow effect on the out div element.

代码如下,但是不知道为什么没有效果。。。下次再看看吧。

$(document).ready(function() {
    $('#testDiv').click(function() {
        alert("test");
        for (var i=0; i<5; i++) {
            $(this).clone()
                .css({
                    position: 'abosolute',
                    left: $(this).offset().left + i,
                    top: $(this).offset().top + i,
                    margin: 0,
                    zIndex: -1,
                    opacity: 0.1
                }).appendTo('body');
                alert($(this).position);
        };
    });
});

天上的神明与星辰,人间的艺术和真纯,我们所敬畏和热爱的,莫过于此。