描点返回-动画

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>描点返回</title>
    <style type="text/css">
    * {
        margin: 0;
        padding: 0;
    }
    
    body {
        max-width: 640px;
        min-width: 320px;
        margin: 0 auto;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .box {
        height: 500px;
    }
    
    .btn {
        display: block;
        width: 50%;
        height: 50px;
        line-height: 50px;
        margin: 20px auto 50px;
        border-radius: 10px;
        text-align: center;
        color: #fff;
        text-decoration: none;
        filter: alpha(opacity=100 finishopacity=50 style=1 startx=0, starty=0, finishx=0, finishy=150) progid: DXImageTransform.Microsoft.gradient(startcolorstr=red, endcolorstr=blue, gradientType=0);
        -ms-filter: alpha(opacity=100 finishopacity=50 style=1 startx=0, starty=0, finishx=0, finishy=150) progid: DXImageTransform.Microsoft.gradient(startcolorstr=red, endcolorstr=blue, gradientType=0);
        /*IE8*/
        background: red;
        /* 一些不支持背景渐变的浏览器 */
        background: -moz-linear-gradient(top, red, rgba(0, 0, 255, 0.5));
        background: -webkit-gradient(linear, 0 0, 0 bottom, from(#ff0000), to(rgba(0, 0, 255, 0.5)));
        background: -o-linear-gradient(top, red, rgba(0, 0, 255, 0.5));
    }
    </style>
</head>

<body>
    <div class="box" style="background: #A39D9D" id="formTab">第一个</div>
    <div class="box" style="background: #E7B2B2">第二个</div>
    <div class="box" style="background: #987F7F">第三个</div>
    <a href="javascript:;" class="btn" onclick="$('html, body').animate({scrollTop : $('#formTab').offset().top}, 500)">我也要测</a>
    <script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
</body>

</html>

效果图:

 简单写在页面里返回指定div:

 οnclick="$('html, body').animate({scrollTop : $('#form_wrapper').offset().top}, 500)"

 

转载于:https://www.cnblogs.com/huanghuali/p/7007149.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值