为了账号安全,请及时绑定邮箱和手机立即绑定

怎样手动滑动div

怎样手动滑动div

慕莱坞森 2018-10-16 13:34:40
我的body里有两个div,默认第一个div, height站满屏,有一个点击事件,点击事件中用什么方法能够滑动到屏幕的底部啊
查看完整描述

1 回答

?
Qyouu

TA贡献1786条经验 获得超11个赞

$("#div").animate({height:'0'});

<style>

body{margin: 0; padding: 0}#content1{    height: 100%;    background-color: #00a0c6;    width: 100%;
}#content2{    width: 100px;    height: 100px;    background-color: white;    z-index: 100;    float: left;    
position: fixed;    top: 0;
}

</style>
<script>

$(function () {
 $('body').height(window.screen.height);
 $('body').width(window.screen.width);
})

</script>
<body>
<div id="content2"></div>
<div id="content1"></div>
<script>

$('#content1').click(function () {
    $('#content2').animate({top:'85%'});
})

</script>


查看完整回答
反对 回复 2018-11-05
  • 1 回答
  • 0 关注
  • 539 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号