Authored by yyq

头部频道前端选中调整

1 {{# headerData}} 1 {{# headerData}}
2 - <div id="yoho-header" class="yoho-header {{headType}}" data-type="{{headType}}"> 2 + <div id="yoho-header" class="yoho-header" data-type="{{headType}}">
3 <div class="tool-wrapper clearfix"> 3 <div class="tool-wrapper clearfix">
4 <div class="center-content"> 4 <div class="center-content">
5 <div class="yoho-group-map left"> 5 <div class="yoho-group-map left">
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
66 <div class="main-logo"><a href="//www.yohobuy.com/" class="main-link"></a></div> 66 <div class="main-logo"><a href="//www.yohobuy.com/" class="main-link"></a></div>
67 <ul class="main-nav-list"> 67 <ul class="main-nav-list">
68 {{# navbars}} 68 {{# navbars}}
69 - <li class="{{type}}{{#if active}} cure{{/if}}" {{#if ico}} style="background: url({{image ico 54 32}}) no-repeat center center"{{/if}}> 69 + <li class="{{type}}"{{#if ico}} style="background: url({{image ico 54 32}}) no-repeat center center"{{/if}}>
70 {{#if ico}} 70 {{#if ico}}
71 <a href="{{link}}"{{#if isNewPage}} target="_blank"{{/if}} class="menu-ico"></a> 71 <a href="{{link}}"{{#if isNewPage}} target="_blank"{{/if}} class="menu-ico"></a>
72 {{^}} 72 {{^}}
@@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
80 </li> 80 </li>
81 {{/ navbars}} 81 {{/ navbars}}
82 </ul> 82 </ul>
83 - <div class="func-area"> 83 + <div class="func-area hide">
84 <ul class="search-suggest"></ul> 84 <ul class="search-suggest"></ul>
85 <div class="search-2016"> 85 <div class="search-2016">
86 <form action="//search.yohobuy.com" method="get" id="search-form"> 86 <form action="//search.yohobuy.com" method="get" id="search-form">
@@ -109,7 +109,7 @@ @@ -109,7 +109,7 @@
109 <div class="nav-wrapper clearfix"> 109 <div class="nav-wrapper clearfix">
110 <div class="center-content"> 110 <div class="center-content">
111 {{# subNavGroup}} 111 {{# subNavGroup}}
112 - <ul class="sub-nav-list {{subType}}{{#if active}} cure{{/if}}"> 112 + <ul class="sub-nav-list {{subType}}">
113 {{# subNav}} 113 {{# subNav}}
114 <li {{#if thirdNav}}class="contain-third"{{/if}}> 114 <li {{#if thirdNav}}class="contain-third"{{/if}}>
115 <a href="{{link}}">{{name}} 115 <a href="{{link}}">{{name}}
@@ -9,6 +9,9 @@ var $ = require('yoho-jquery'); @@ -9,6 +9,9 @@ var $ = require('yoho-jquery');
9 var homePage = $('.home-page').data('page'), 9 var homePage = $('.home-page').data('page'),
10 brandUrl = $('.logo-brand').data('url'); 10 brandUrl = $('.logo-brand').data('url');
11 11
  12 +// 给头部js获取当前频道
  13 +window.homePage = homePage;
  14 +
12 require('../common'); 15 require('../common');
13 16
14 require('../plugins/slider'); 17 require('../plugins/slider');
@@ -487,20 +487,17 @@ function isSupportCss3Animation() { @@ -487,20 +487,17 @@ function isSupportCss3Animation() {
487 function syncPageChannel() { 487 function syncPageChannel() {
488 var $header = $('#yoho-header'), 488 var $header = $('#yoho-header'),
489 $navs; 489 $navs;
490 - var channel = window.cookie('_Channel') || 'boys',  
491 - type; 490 + var channel = window.homePage || window.cookie('_Channel') || 'boys',
  491 + qs = window.queryString();
492 492
493 - // 过滤频道页  
494 - if ($('.home-page').length) {  
495 - return;  
496 - } 493 + channel = qs.channel ? qs.channel : channel;
497 494
498 if ($header && $header.length) { 495 if ($header && $header.length) {
499 $navs = $header.find('.' + channel); 496 $navs = $header.find('.' + channel);
500 - type = $header.data('type');  
501 497
502 - if (channel === type || !$navs.length) {  
503 - return; 498 + if (!$navs.length) {
  499 + channel = 'boys';
  500 + $navs = $header.find('.' + channel);
504 } 501 }
505 502
506 // 更新频道菜单选中状态 503 // 更新频道菜单选中状态
@@ -508,7 +505,7 @@ function syncPageChannel() { @@ -508,7 +505,7 @@ function syncPageChannel() {
508 $navs.addClass('cure'); 505 $navs.addClass('cure');
509 506
510 // 更新频道颜色 507 // 更新频道颜色
511 - $header.attr('class', 'yoho-header ' + channel); 508 + $header.addClass(channel).find('.func-area').removeClass('hide');
512 509
513 // 更新三级菜单jq对象 510 // 更新三级菜单jq对象
514 $subNav = $('.sub-nav-list.cure .contain-third'); 511 $subNav = $('.sub-nav-list.cure .contain-third');
@@ -598,7 +598,6 @@ @@ -598,7 +598,6 @@
598 .nav-wrapper { 598 .nav-wrapper {
599 height: 40px; 599 height: 40px;
600 width: 100%; 600 width: 100%;
601 - background-color: #3a3a3a;  
602 position: relative; 601 position: relative;
603 602
604 .sub-nav-list { 603 .sub-nav-list {
@@ -726,6 +725,12 @@ @@ -726,6 +725,12 @@
726 } 725 }
727 } 726 }
728 727
  728 +.yoho-header.boys {
  729 + .nav-wrapper {
  730 + background-color: #3a3a3a;
  731 + }
  732 +}
  733 +
729 .yoho-header.girls { 734 .yoho-header.girls {
730 .search-2016 { 735 .search-2016 {
731 background-color: #ff88ae; 736 background-color: #ff88ae;