css easeoutbounce,缓冲效果插件easing用法

本站的导航条二级菜单展开缓冲效果就是使用插件easing实现的,类似弹簧的缓冲效果...

在实际应用中偶尔会使用到这个插件以实现缓冲效果,现在这里记录下插件easing的用法。此插件依赖jquery库,自身是一个js插件文件,引用代码如下:

最常使用的插件属性为easeOutBounce,调用方法:

easing:"easeOutBounce"

完整可运行的代码如下:

缓冲效果插件easing用法

*{margin:0;padding:0;}

body{padding:50px;}

.clickBox{width:200px;height:45px;margin:0 auto; text-align:center;padding:10px;}

.demo{width:200px; height:200px; border:1px red solid;margin:0 auto;}

.demo p{width:200px; height:200px; background:#0f0; display:block;overflow:hidden; text-align:center;}

$(function(){

$(".demo p").css({

//width:0,

height:0

})

$("a").hover(function(){

$(".demo >p").animate({

//width:200,

height:200

},{duration:1000,easing:"easeOutBounce"})

},function(){

$(".demo >p").animate({

//width:0,

height:0

},{duration:1000,easing:"easeOutBounce",complete:done})

});

function done(){

console.log("easing函数执行完,此处为回调函数!");

}

})

测试:鼠标移出移入

缓冲效果

提示:你可以先修改部分代码再运行。

去掉3处的width注释,并注释掉3处高度height的定义,可查看横向的缓冲效果!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值