Line 53: | Line 53: | ||
<div class="col-sm-12" id="content-wrapper" style="padding: 0;margin: 0;"> | <div class="col-sm-12" id="content-wrapper" style="padding: 0;margin: 0;"> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<!-- BEGIN HEADER --> | <!-- BEGIN HEADER --> | ||
<div class="header clearfix" id="header" style="width: 100%;position: relative;padding-bottom: 20px;background-size:cover; | <div class="header clearfix" id="header" style="width: 100%;position: relative;padding-bottom: 20px;background-size:cover; | ||
background-image: url(https://static.igem.org/mediawiki/2016/9/9a/T--BIT-China--img--top_bg.png);"> | background-image: url(https://static.igem.org/mediawiki/2016/9/9a/T--BIT-China--img--top_bg.png);"> | ||
− | <!-- | + | |
− | <div class="col-sm-12 | + | |
− | <div class="header-container clearfix | + | <!--显示在顶部的导航栏——不固定--> |
− | style="margin-top: | + | <div class="col-sm-12 clearfix " style="padding: 0;height: 106px;"> |
− | + | <div class="header-container clearfix home-img" id="header-container" | |
− | + | style="margin-top: 20px;z-index: 10" > | |
+ | |||
+ | <a href="https://2016.igem.org/Team:BIT-China"> | ||
+ | <div class="site-logo center-block col-sm-1" style="display: table;padding: 0;height: 100%;"> | ||
<span style="display: table-cell;vertical-align: middle;"> | <span style="display: table-cell;vertical-align: middle;"> | ||
<img src="https://static.igem.org/mediawiki/2016/e/e2/T--BIT-China--img--logo-purple.png" | <img src="https://static.igem.org/mediawiki/2016/e/e2/T--BIT-China--img--logo-purple.png" | ||
Line 171: | Line 154: | ||
</div> | </div> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</div> | </div> | ||
Line 220: | Line 197: | ||
var site_change_btn=$("#site-change-btn").eq(0); | var site_change_btn=$("#site-change-btn").eq(0); | ||
window.onscroll = function () { | window.onscroll = function () { | ||
− | + | ||
− | + | //滚动监听,实现导航栏平滑固定 | |
− | } | + | var scroll = $(window).scrollTop(); |
− | + | var header=$("#header-container"); | |
− | + | if (scroll >= 100) { | |
+ | if(header.css("position") != "fixed"){ | ||
+ | header.css({position:"fixed",top:"-70px"}).animate({ | ||
+ | top:"0",width:"100%",marginTop:"0px" | ||
+ | },100,"linear"); | ||
+ | } | ||
+ | |||
+ | //添加导航下拉class,删除两侧padding | ||
+ | header.addClass("roll-nav"); | ||
+ | header.removeClass("home-img"); | ||
+ | }else if (scroll <= 100) { | ||
+ | if(header.css("position") != "static"){ | ||
+ | header.animate({ | ||
+ | top:"-70px", | ||
+ | },100,"linear",function(){ | ||
+ | header.css({position:"static"}) | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | //删除导航下拉class,增加两侧padding | ||
+ | header.removeClass("roll-nav"); | ||
+ | header.addClass("home-img"); | ||
} | } | ||
+ | //导航栏平滑滚动——END | ||
//固定侧边导航 | //固定侧边导航 | ||
− | if( | + | if(scroll>95){ |
nav_left_wrapper.css({ | nav_left_wrapper.css({ | ||
"margin-left":"0", | "margin-left":"0", | ||
Line 252: | Line 251: | ||
//页间跳转 —— 滚动一定长度之后显示 | //页间跳转 —— 滚动一定长度之后显示 | ||
− | if( | + | if(scroll>200){ |
site_change_btn.css("display","block"); | site_change_btn.css("display","block"); | ||
} | } | ||
Line 366: | Line 365: | ||
}); | }); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</script> | </script> | ||
<body> | <body> | ||
</html> | </html> |
Revision as of 15:13, 9 November 2016