最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

css實現(xiàn)網(wǎng)頁欄目左側固定當滾動到底部時自動調整位置

  發(fā)布時間:2019-05-29 14:44:54   作者:佚名   我要評論
這篇文章主要介紹了css實現(xiàn)網(wǎng)頁欄目左側固定當滾動到底部時自動調整位置 ,需要的朋友可以參考下

預覽地址:

https://ovsexia.gitee.io/leftfixed/

html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="js/jquery-1.10.1.min.js" type="text/javascript"></script>
<link href="css/layout.css" type="text/css" rel="stylesheet" />
<link href="css/style.css" type="text/css" rel="stylesheet" />
</head>
<div class="top"></div>
<div class="page">
  <div class="left">
    <div class="left_poi"></div>
    <div class="left_in">
      <p><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p>
    </div><!--left_in-->
    <script>
    $(window).scroll(function()
    {
        saction();
    });
    function saction()
    {
        sj = 20; //底部間隔
        st = $(window).scrollTop(); //滾動條高度
        sd = $(".left_poi").offset().top;
        sd_h = $(".left_in").height();
        sb = $(".bottom").offset().top;
        sb_h = $(".bottom").height();
        rd_h = $(".right").height();
        bh = window.innerHeight;
        si = sb-sd_h;
        if(st>sd && rd_h>=sd_h){
            $(".left_in").addClass("on");
            if(st>si){
                sy = bh-(sb-st)+sj;
                $(".left_in").css({"top":"auto","bottom":sy+"px"});
            }else{
                $(".left_in").css({"top":"","bottom":""});
            }
        }else{
            $(".left_in").removeClass("on");
        }
    }
    </script>
  </div><!--left-->
  <div class="right"></div>
  <div class="clear"></div>
</div><!--page-->
<div class="bottom"></div>
</body>
</html>

css

@charset "utf-8";
.clear {clear:both; height:0 !important; width:0 !important; overflow:hidden; font-size:0;}
.top {width:100%; height:150px; background:#0CC;}
.bottom {width:100%; height:400px; background:#39C;}
.page {width:1200px; margin:20px auto; position:relative;}
.left {width:200px; float:left;}
.left_in {width:200px; background:#46bc67; border-top:3px solid #000; border-bottom:3px solid #000;}
.left_in.on {position:fixed; top:0;}
.left_poi {width:100%; height:1px; overflow:hidden;}
.right {width:960px; height:2100px; float:right; overflow:hidden; background:#FC3;}

總結

以上所述是小編給大家介紹的css實現(xiàn)網(wǎng)頁欄目左側固定當滾動到底部時自動調整位置 ,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關文章

  • CSS實現(xiàn)底部tapbar欄功能

    最近小編接了一個項目需要實現(xiàn)手機端底部tab欄切換功能,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友參考下吧
    2020-04-22

最新評論

全州县| 定陶县| 讷河市| 周至县| 道真| 高邮市| 汝城县| 扎鲁特旗| 永安市| 嫩江县| 安西县| 白朗县| 修武县| 北京市| 枞阳县| 翁牛特旗| 永胜县| 苍溪县| 聊城市| 教育| 安溪县| 绿春县| 手游| 五指山市| 承德县| 恩施市| 若羌县| 永康市| 舟山市| 安福县| 周口市| 桐城市| 泗洪县| 塔河县| 交城县| 平凉市| 绥芬河市| 邮箱| 乃东县| 应城市| 将乐县|