Authored by ccbikai

顶部图标点击背景变色

@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 */ 5 */
6 var $ = require('jquery'); 6 var $ = require('jquery');
7 7
8 -var $footer = $('#yoho-footer'); 8 +var $footer = $('#yoho-footer'),
  9 + $header = $('.yoho-header');
9 10
10 function cookie(name) { 11 function cookie(name) {
11 var cookies = document.cookie, 12 var cookies = document.cookie,
@@ -152,6 +153,13 @@ function rePosFooter() { @@ -152,6 +153,13 @@ function rePosFooter() {
152 } 153 }
153 }()); 154 }());
154 155
  156 +$header.on('touchstart', 'a', function() {
  157 + $header.find('a').removeClass('highlight');
  158 + $(this).addClass('highlight');
  159 +}).on('touchend touchcancel', 'a', function() {
  160 + $(this).removeClass('highlight');
  161 +});
  162 +
155 163
156 //暴露公共接口 164 //暴露公共接口
157 window.cookie = cookie; 165 window.cookie = cookie;
@@ -214,8 +214,13 @@ function tsAnimate() { @@ -214,8 +214,13 @@ function tsAnimate() {
214 214
215 setTimeout(tsAnimate, 3000); 215 setTimeout(tsAnimate, 3000);
216 216
217 -// 底部留出tab 的高度 217 +$('.home-header .search-btn').on('touchstart', function() {
  218 + $(this).addClass('highlight');
  219 +}).on('touchend touchcancel', function() {
  220 + $(this).removeClass('highlight');
  221 +});
218 222
  223 +// 底部留出tab 的高度
219 $('#yoho-footer').css({ 224 $('#yoho-footer').css({
220 'margin-bottom': '2.5rem' 225 'margin-bottom': '2.5rem'
221 }); 226 });
@@ -63,11 +63,21 @@ @@ -63,11 +63,21 @@
63 63
64 .search-btn { 64 .search-btn {
65 position: absolute; 65 position: absolute;
66 - right: 32rem / $pxConvertRem; 66 + right: 0;
67 top: 0; 67 top: 0;
68 - bottom: 0;  
69 - a{ 68 + width: 90rem / $pxConvertRem;
  69 + height: 90rem / $pxConvertRem;
  70 + text-align: center;
  71 +
  72 + a {
  73 + display: block;
70 color: #fff; 74 color: #fff;
  75 + font-size: 40rem / $pxConvertRem;
  76 + line-height: 90rem / $pxConvertRem;
  77 + }
  78 +
  79 + &.highlight {
  80 + background: rgba(200,200,200,.4);
71 } 81 }
72 } 82 }
73 } 83 }
@@ -24,26 +24,31 @@ @@ -24,26 +24,31 @@
24 background: #4f4138; 24 background: #4f4138;
25 } 25 }
26 26
27 - .nav-back { 27 + a.highlight {
  28 + background: rgba(200,200,200,.1);
  29 + }
  30 +
  31 + %nav {
  32 + display: block;
28 position: absolute; 33 position: absolute;
29 - left: 34rem / $pxConvertRem;  
30 - top: 28rem / $pxConvertRem;  
31 - width: 18rem / $pxConvertRem;  
32 - height: 32rem / $pxConvertRem;  
33 - background: image-url('layout/back.png') no-repeat;  
34 - background-size: 100% 100%; 34 + top: 0;
  35 + width: 90rem / $pxConvertRem;
  36 + height: 90rem / $pxConvertRem;
  37 + font-size: 40rem / $pxConvertRem;
  38 + line-height: 90rem / $pxConvertRem;
  39 + color: #fff;
  40 + text-align: center;
35 outline: none; 41 outline: none;
36 } 42 }
37 43
  44 + .nav-back {
  45 + @extend %nav;
  46 + left: 0;
  47 + }
  48 +
38 .nav-home { 49 .nav-home {
39 - position: absolute;  
40 - top: 28rem / $pxConvertRem;  
41 - right: 34rem / $pxConvertRem;  
42 - width: 20px;  
43 - height: 20px;  
44 - background: image-url('layout/home.png') no-repeat;  
45 - background-size: 100% 100%;  
46 - outline: none; 50 + @extend %nav;
  51 + right: 0;
47 } 52 }
48 53
49 .nav-title { 54 .nav-title {
1 {{#pageHeader}} 1 {{#pageHeader}}
2 <header class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}"> 2 <header class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}">
3 {{#if navBack}} 3 {{#if navBack}}
4 - <a href="javascript:history.go(-1);" class="nav-back"></a> 4 + <a href="javascript:history.go(-1);" class="iconfont nav-back">&#xe610;</a>
5 {{/if}} 5 {{/if}}
6 {{#navHome}} 6 {{#navHome}}
7 - <a href="{{.}}" class="nav-home"></a> 7 + <a href="{{.}}" class="iconfont nav-home">&#xe611;</a>
8 {{/navHome}} 8 {{/navHome}}
9 {{#navTitle}} 9 {{#navTitle}}
10 <p class="nav-title">{{.}}</p> 10 <p class="nav-title">{{.}}</p>