简体   繁体   English

使用jQuery提供阴影效果

[英]Give shadow effect using jQuery

我想使用jQuery给出叠加和阴影效果。我很难使用它

You do not need a shadow plugin for this. 你不需要一个影子插件。 Use the following cross browser shadow CSS properties and put them in a class name .shadow . 使用以下跨浏览器阴影CSS属性并将它们放在类名.shadow Then using jquery's addClass() function you can add the shadow class to any element that you want to have a shadow. 然后使用jquery的addClass()函数,您可以将阴影类添加到您想要有阴影的任何元素。

CSS CSS

.shadow{
    -moz-box-shadow: 3px 3px 4px #ccc;
    -webkit-box-shadow: 3px 3px 4px #ccc;
    box-shadow: 3px 3px 4px #ccc; /* For IE 8 */
    -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#cccccc')"; /* For IE 5.5 - 7 */
    filter: progid:DXImageTransform.Microsoft.Shadow(Strength = 4, Direction = 135, Color = '#cccccc');
}

jQuery jQuery的

$('div').addClass('shadow');

The above jQuery selector will apply shadow to div element. 上面的jQuery选择器将阴影应用于div元素。 Similarly you can apply the same shadow class to any element that you want to have a shadow. 类似地,您可以将相同的阴影类应用于您想要具有阴影的任何元素。 You can Adjust the shadow CSS properties as needed. 您可以根据需要调整阴影CSS属性。

Check working example at http://jsfiddle.net/ttCSQ/1/ 查看http://jsfiddle.net/ttCSQ/1/上的工作示例

the shadow part: 阴影部分:

<script type="text/javascript">
    $(function(){
       $("#exampleDiv").shadow({
           width:5, 
           startOpacity:60, 
           endOpacity:10, 
           cornerHeight:8, 
           color:"#000000"
       });
    })
</script>

this is for the overlay part : http://flowplayer.org/tools/overlay/index.html 这是覆盖部分: http//flowplayer.org/tools/overlay/index.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM