html的点击拉伸效果,html 用js改变 拉伸的一个效果;

HTML 结构

原理︰

1. 一开始 #footerSlideContent 拿取自身高度、然後 Dom ready 之後就把 height 设成 0 隐藏掉

2. 在 #footerSlideNav 是一个控制台,内容随便,没有特别,就是在里面设置一个 的开关

3. 点击 #showFooter,#footerSlideContent 就会把高度用 animate 表现出来,做成 slide up 的效果

#footerSlideContainer {

position: fixed;

bottom: 0;

left: 0;

width: 100%;

}

JS 重点

var original_h = $('#footerSlideContent').height(); // 先拿取高度

$('#footerSlideContent').height(0); // 隐藏整个 Content

$('#showFooter').click(function(){

$('#footerSlideContent').animate({

'height' : original_h // 回复 footerSlideContent 的高度,用 animate 效果

});

});

其它的你应该懂的吧 样式控制位置的; 可以改变;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值