jQuery插件Round Shadow实现圆角和阴影(使用)

本文详细介绍了jQuery插件RoundShadow的使用方法及配置选项。该插件可通过多种装饰方式为网页元素添加圆角和阴影效果,包括使用table标签、框模型和CSS3等方法。文章还提供了各装饰方式下具体的配置参数说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用该插件的基本语法如下:
$(selector).roundShadow(options);或jQuery(selector).roundShadow(options);
options的可选项针对不同的装饰方式分如下三种情况:
共同部分:
theme{String} : 装饰方法,可选项有"default","simple","css"。其中"default"使用table标签对元素进行装饰,"simple"使用框模型对元素进行装饰,"css"使用css3对元素进行装饰。
不同部分:
theme = "default":
radius{String,Number}: 圆角半径,即所裁剪的圆角阴影图片的左上角的宽度(裁剪部分应为四分之一圆,且高宽应一样),单位为"px",不接受其他单位的大小值,也可以使用数字。默认值为"12px"。
tag{String}: 指定对所装饰节点的文本节点所添加的HTML标签,默认值为"<div></div>"。
theme = "simple":
prefix{String}: 对所装饰节点应用的圆角和阴影的css类前缀,假如类前缀为"simple-round-shadow"(插件默认使用的类),则至少需定义如下类:"simple-round-shadow-body","simple-round-shadow-top","simple-round-shadow-bottom",且类中必须要指定background-image的值。默认值为"simple-round-shadow"。
tag{String}: 指定对所装饰节点的文本节点所添加的HTML标签,默认值为"<div></div>"。
theme = "css":
shadowXOffset{String,Number}: 阴影在X轴上的偏移量,以"px"为单位。默认为"1px"。
shadowYOffset{String,Number}: 阴影在Y轴上的偏移量,以"px"为单位。默认为"1px"。 shadowDepth{String,Number}: 阴影的浓度,以"px"为单位。默认为"4px"。
shadowColor{String}: 阴影颜色。默认为"#000000"。
roundRadius{String,Number}: 圆角半径,以"px"为单位。默认为"10px"。
border{String}: 元素边框样式,与css中的border设置相同。默认为"1px solid #000"。
CSS类定义说明:
1、当theme为"default",并且要使用自定义的css类时需注意,必须定义以下类:
"round-shadow-top-left","round-shadow-top-edge","round-shadow-top-right";
"round-shadow-left-edge","round-shadow-center-board","round-shadow-right-edge";
"round-shadow-bottom-left","round-shadow-bottom-edge","round-shadow-bottom-right";
与默认使用的css类只有相应的背景图片和图片的高宽需要根据具体情况进行修改,其他的都需要和默认的定义相同。默认样式如下:

.default-round-shadow {
}
.default-round-shadow table {
}
/* round shadow panel's top*/
.round-shadow-top-left {
width: 12px;
height: 12px;
background: transparent url("images/default/top_left.png") no-repeat;
}
.round-shadow-top-edge {
height: 12px;
background: transparent url("images/default/top_edge.png") repeat-x;
}
.round-shadow-top-right {
width: 12px;
height: 12px;
background: transparent url("images/default/top_right.png") no-repeat;
}
/* round shadow panel's body*/
.round-shadow-left-edge {
width: 12px;
background: transparent url("images/default/left_edge.png") repeat-y;
}
.round-shadow-center-board {
background: transparent url("images/default/center_board.png") repeat;
}
.round-shadow-right-edge {
width: 12px;
background: transparent url("images/default/right_edge.png") repeat-y;
}
/* round shadow panel's bottom*/
.round-shadow-bottom-left {
width: 12px;
height: 12px;
background: transparent url("images/default/bottom_left.png") no-repeat;
}
.round-shadow-bottom-edge {
height: 12px;
background: transparent url("images/default/bottom_edge.png") repeat-x;
}
.round-shadow-bottom-right {
width: 12px;
height: 12px;
background: transparent url("images/default/bottom_right.png") no-repeat;
}

2、当theme为"simple",并且使用自定义的css类时同样需注意如下要求:
假如使用的prefix为simple,则需定义simple-body,simple-top和simple-bottom三个类,并且在这三个类中均要指定背景图片的url且背景色最好设置为transparent。默认样式如下:

.simple-round-shadow {
background-color: transparent;
}
.simple-round-shadow-top {
/* background-image is necessary*/
background: transparent url("images/simple/top.png") no-repeat;
}
.simple-round-shadow-body {
/* background-image is necessary*/
background: transparent url("images/simple/body.png") repeat-y;
}
.simple-round-shadow-bottom {
/* background-image is necessary*/
background: transparent url("images/simple/bottom.png") no-repeat;
}


项目已放到Google Code上,可以下载:[url]http://code.google.com/p/jquery-round-shadow/[/url]

[url=http://www.iteye.com/topic/913974]jQuery插件Round Shadow实现圆角和阴影(原理一)[/url]
[url=http://www.iteye.com/topic/913984]jQuery插件Round Shadow实现圆角和阴影(原理二)[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值