请教jquery ui问题

chinabber 2012-10-20 06:24:47
兄弟我最近在看jquery ui,他有各种效果比较酷,官方的范例代码是:effect( effect [, options ] [, duration ] [, complete ] ),第二个参数是字符串指定效果类型,第三个参数是时间,最后一个是回调函数,只是第二个参数找遍官方网页也没有相关知道,只知道是个object对象,哪位兄弟知道里这个参数的用法?里面到底有哪些选项?我搜索也没有找到有用的网页,哪位兄弟知道?
...全文
155 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
chinabber 2012-10-24
  • 打赏
  • 举报
回复
感谢了,我试一下,
泡泡鱼_ 2012-10-20
  • 打赏
  • 举报
回复
空对象??你没看到:scale,transfer,size三个效果都是有参数的???
下面是事件列表以及其options列表;[自己网上找找就有了,我这是想自己做个标记,否则不会贴出来]
blind:
  mode:值为hide/show
  direction:值为vertical/horizontal
bounce:
  direction: 值为up/down/left/right
  distance: 值为数值,默认为20
  times: 值为数值,默认为5
  duration:值为数值,每个弹跳的速度,默认值250ms
clip:
  mode:值为show/hide
  direction:值为vertical/horizontal
drop
  direction: 值为left/right/top/down
  mode: 值为show/hide
  distance:值为数值。
explode
  pieces: 值为数字,爆炸的块数。默认为9
  mode: 值为show/hide/toggle
fade
  mode: 值为show/hide
fold
  mode:值为show/hide
  size: 值为数值,折叠的大小,默认为15
  horizFirst:bool值,是否先水平方向折叠
highlight
  mode: 值为show/hide
  color: 值为颜色值,默认为#ffff99
pulsate
  mode:值为show/hide
  times:值为数值,跳动的次数
puff
  mode:值为show/hide
  percent: 值为数值,膨胀的比例,默认为150
scale
  mode:值为show/hide
  percent: 值为数值
  direction:vertical/horizontal/both
  origin:原始大小
  from: 效果开始的大小
size
  mode:值为show/hide
  restore: bool类型,默认false
  scale:vertical/horizontal/both
  origin:原始大小
  from:从一定的高度和宽度开始
  to:到一定的高度和宽度结束
shake
  mode:值为show/hide
  direction: 值为left/right/up/down,默认值left
  distance: 值为数字,默认值20
  times:值为数字
  duration:每次效果的速度
slide
  mode:值为show/hide
  direction: 值为left/right/up/down
  distance: 值为数值
transfer
  to:目标jQuery对象
  className: 需要添加的css样式名称.
chinabber 2012-10-20
  • 打赏
  • 举报
回复
兄弟,感谢你的回复,不过你说的例子我早已看过了,例子中的options是个空object,里面没有任何设置,我就是想知道里面有哪些属性,怎么用
泡泡鱼_ 2012-10-20
  • 打赏
  • 举报
回复
呵呵,你绝对没有“找遍官方网页”
因为第二个参数:options在演示页面中就有。它是对一些特殊效果的参数支持

function runEffect() {
// get effect type from
var selectedEffect = $("#effectTypes").val();
// most effect types need no options passed by default
var options = {};
// some effects have required parameters
if (selectedEffect === "scale") {
options = {
percent: 0
};
} else if (selectedEffect === "transfer") {
options = {
to: "#button",
className: "ui-effects-transfer"
};
} else if (selectedEffect === "size") {
options = {
to: {
width: 200,
height: 60
}
};
}
// run the effect
$("#effect").effect(selectedEffect, options, 500, callback);

};

87,991

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧