亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

頁面中常見返回頂部效果

原創(chuàng) 2018-12-10 14:31:49 261
摘要:<!DOCTYPE html> <html>     <head>         <title>頁面中常見返回頂部效果(TOP)</title>      &
<!DOCTYPE html>
<html>
    <head>
        <title>頁面中常見返回頂部效果(TOP)</title>
        <meta charset="UTF-8">
        <link rel="shortcut icon"  href="static/images/logo.png" type="image/x-icon" />
        <link rel="stylesheet" href="static/css/style.css" type="text/css">
        <link rel="stylesheet" type="text/css" href="static/font-awesome/css/font-awesome.min.css">
        <script type="text/javascript" src="static/js/jquery.js"></script>  
        <script>
        $(function(){
                $('#back').hide();
                $(window).scroll(function(){
                    if($(window).scrollTop()>150){
                        $('#back').fadeIn(1000);
                    }else{
                        $('#back').fadeOut(1000);
                    }
                })
            })
       </script>
    </head>
    <body>
    <a href="#top"></a>
        <div>網(wǎng)頁頂部
        </div>
        <p id="back"><a href="" id="top"><span class="fa fa-arrow-circle-up"></span><br/>返回頂部</a>
   </p>
    </body>
</html>
*{
margin: 0px; 
padding: 0px;
}
body{
text-align: center;
}
div{
width: 1200px;
height:2000px;
background: lightblue;
margin: 30px auto;
}
p#back{
width:80px;
height:60px;
background: #ccc;
position: fixed;
bottom: 90px;
right:10px;
text-align: center;
border-radius: 10px;
}
p#back:hover{
background: #6D6E6A;
}
a{
text-decoration: none;
color:black;
}

總結:通過這個案例,復習了返回頁面頂部的操作,即錨點的使用。同時鞏固了jquery中的scroll()方法。錨點.png


批改老師:滅絕師太批改時間:2018-12-10 14:42:13
老師總結:這是個布局中常用的小案例,也是對前面知識點的復習,繼續(xù)加油!

發(fā)佈手記

熱門詞條