|
@@ -60,7 +60,7 @@
|
|
|
</div>
|
|
|
<div class="listBox">
|
|
|
<div class="width1200">
|
|
|
- <div class="listNav">
|
|
|
+ <div class="listNav" id="bignav">
|
|
|
<ul class="clearfix">
|
|
|
<li><a href="lists-guangdong.html">广东</a></li>
|
|
|
<li class="active"><a href="lists-gansu.html">甘肃</a></li>
|
|
@@ -782,5 +782,31 @@
|
|
|
<!-- JS. -->
|
|
|
<script src="js/jquery/jquery-3.2.1.min.js"></script>
|
|
|
<script src="js/global.js"></script>
|
|
|
+ <script type="text/javascript">
|
|
|
+ window.onscroll=function(){
|
|
|
+ var topScroll = get_scrollTop_of_body();//滚动的距离,距离顶部的距离
|
|
|
+ var bignav = document.getElementById("bignav");//获取到导航栏id
|
|
|
+ if(topScroll > 580){ //当滚动距离大于250px时执行下面的东西
|
|
|
+ bignav.style.position = 'fixed';
|
|
|
+ bignav.style.top = '0';
|
|
|
+ bignav.style.zIndex = '9999';
|
|
|
+ }else{//当滚动距离小于250的时候执行下面的内容,也就是让导航栏恢复原状
|
|
|
+ bignav.style.position = 'static';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*解决浏览器兼容问题*/
|
|
|
+ function get_scrollTop_of_body(){
|
|
|
+ var scrollTop;
|
|
|
+ if(typeof window.pageYOffset != 'undefined'){//pageYOffset指的是滚动条顶部到网页顶部的距离
|
|
|
+ scrollTop = window.pageYOffset;
|
|
|
+ }else if(typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
|
|
|
+ scrollTop = document.documentElement.scrollTop;
|
|
|
+ }else if(typeof document.body != 'undefined'){
|
|
|
+ scrollTop = document.body.scrollTop;
|
|
|
+ }
|
|
|
+ return scrollTop;
|
|
|
+ }
|
|
|
+
|
|
|
+ </script>
|
|
|
</body>
|
|
|
</html>
|