Authored by ccbikai

频道选择页面顶部搜索优化

@@ -8,7 +8,7 @@ var $searchBox = $('.search-box'), @@ -8,7 +8,7 @@ var $searchBox = $('.search-box'),
8 $indexSearch = $('.index-search'), 8 $indexSearch = $('.index-search'),
9 $indexLogo = $('.index-logo'); 9 $indexLogo = $('.index-logo');
10 10
11 -$searchBox.find('input').on('focus', function() { 11 +function showBigSearch() {
12 $indexLogo.css({ 12 $indexLogo.css({
13 width: 0 13 width: 0
14 }); 14 });
@@ -19,7 +19,9 @@ $searchBox.find('input').on('focus', function() { @@ -19,7 +19,9 @@ $searchBox.find('input').on('focus', function() {
19 width: '15.5rem' 19 width: '15.5rem'
20 }); 20 });
21 $('.clear-text, .no-search').show(); 21 $('.clear-text, .no-search').show();
22 -}).on('blur', function() { 22 +}
  23 +
  24 +function hideBigSearch() {
23 $indexLogo.css({ 25 $indexLogo.css({
24 width: '5.4rem' 26 width: '5.4rem'
25 }); 27 });
@@ -30,12 +32,22 @@ $searchBox.find('input').on('focus', function() { @@ -30,12 +32,22 @@ $searchBox.find('input').on('focus', function() {
30 width: '9.6rem' 32 width: '9.6rem'
31 }); 33 });
32 $('.clear-text, .no-search').hide(); 34 $('.clear-text, .no-search').hide();
  35 +}
  36 +
  37 +$searchBox.find('input').on('focus', function() {
  38 + showBigSearch();
33 }); 39 });
34 -$searchBox.find('.clear-text').click(function() {  
35 - $searchBox.find('input').val('').trigger('focus'); 40 +
  41 +$searchBox.find('.clear-text').on('touchend', function() {
  42 + $searchBox.find('input').val('');
36 }); 43 });
37 -$searchBox.find('.search-icon').click(function() { 44 +$searchBox.find('.search-icon').on('touchend', function() {
38 $indexSearch.submit(); 45 $indexSearch.submit();
39 }); 46 });
40 47
  48 +$('.no-search').on('touchend', function() {
  49 + $searchBox.find('input').val('');
  50 + hideBigSearch();
  51 +});
  52 +
41 window.rePosFooter(); 53 window.rePosFooter();
@@ -24,7 +24,8 @@ @@ -24,7 +24,8 @@
24 width: 384rem / $pxConvertRem; 24 width: 384rem / $pxConvertRem;
25 height: 112rem / $pxConvertRem; 25 height: 112rem / $pxConvertRem;
26 overflow: hidden; 26 overflow: hidden;
27 - transition: width 400ms; 27 + z-index: 3;
  28 + @include transition(width .4s);
28 .search-box { 29 .search-box {
29 float: left; 30 float: left;
30 position: relative; 31 position: relative;
@@ -96,10 +97,10 @@ @@ -96,10 +97,10 @@
96 min-height: 800rem / $pxConvertRem; 97 min-height: 800rem / $pxConvertRem;
97 98
98 .index-channel-list { 99 .index-channel-list {
99 - padding-top: 50%; 100 + margin-top: -50%;
100 width: 100%; 101 width: 100%;
101 position: absolute; 102 position: absolute;
102 - top: -180rem / $pxConvertRem; 103 + top: 50%;
103 104
104 .list-item { 105 .list-item {
105 display: block; 106 display: block;
@@ -114,6 +115,9 @@ @@ -114,6 +115,9 @@
114 background: #000; 115 background: #000;
115 border: 4px solid #fff; 116 border: 4px solid #fff;
116 font-weight: bold; 117 font-weight: bold;
  118 + &:last-child {
  119 + margin-bottom: 0;
  120 + }
117 } 121 }
118 .lighter { 122 .lighter {
119 font-weight: lighter; 123 font-weight: lighter;