Authored by 王洪广

add fashion text

1 var $ = require('yoho-jquery'), 1 var $ = require('yoho-jquery'),
2 IScroll = require('yoho-iscroll'); 2 IScroll = require('yoho-iscroll');
3 3
4 -//var WILL_BEGIN = '即将开始'; 4 +// var WILL_BEGIN = '即将开始';
5 var WILL_END = '即将结束'; 5 var WILL_END = '即将结束';
6 var ONLINE_FORECAST = '上线预告'; 6 var ONLINE_FORECAST = '上线预告';
7 7
@@ -92,8 +92,29 @@ function activeNav() { @@ -92,8 +92,29 @@ function activeNav() {
92 92
93 } 93 }
94 94
  95 +function fixNav() {
  96 + var navHeight = 0;
  97 + var $navContainer = $('#index_nav');
  98 +
  99 + if ($navContainer.size() > 0) {
  100 + navHeight = $navContainer.height();
  101 +
  102 + // 顶部app下载位置
  103 + $(window).on('scroll', function() {
  104 + var scrollTop = $(window).scrollTop();
  105 +
  106 + if (scrollTop >= navHeight) {
  107 + $navContainer.addClass('nav-fix');
  108 + } else {
  109 + $navContainer.removeClass('nav-fix');
  110 + }
  111 + });
  112 + }
  113 +}
95 114
96 activeNav(); 115 activeNav();
  116 +fixNav();
  117 +
97 118
98 module.exports = initNavScroll; 119 module.exports = initNavScroll;
99 120
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 white-space: nowrap; 6 white-space: nowrap;
7 position: relative; 7 position: relative;
8 overflow: hidden; 8 overflow: hidden;
  9 + background: #fff;
9 10
10 ul { 11 ul {
11 padding: 0 20px; 12 padding: 0 20px;
@@ -66,3 +67,10 @@ @@ -66,3 +67,10 @@
66 } 67 }
67 } 68 }
68 } 69 }
  70 +
  71 +.nav-fix {
  72 + position: fixed;
  73 + top: 0;
  74 + left: 0;
  75 + z-index: 100;
  76 +}