Authored by ccbikai

侧边栏 品牌一览 频道选择 点击背景色变化

@@ -64,6 +64,18 @@ $(window).scroll(function() { @@ -64,6 +64,18 @@ $(window).scroll(function() {
64 }); 64 });
65 }); 65 });
66 66
  67 +function changeBackground() {
  68 + var $brandList = $('.brand-list').find('p');
  69 +
  70 + $brandList.on('touchstart', function() {
  71 + $brandList.css('background', '#fff');
  72 + $(this).css('background', '#eee');
  73 + }).on('touchend touchcancel', function() {
  74 + $(this).css('background', '#fff');
  75 + });
  76 +}
  77 +changeBackground();
  78 +
67 function searchResult() { 79 function searchResult() {
68 var keyword = ($keyword.val() + '').toLowerCase(); 80 var keyword = ($keyword.val() + '').toLowerCase();
69 var result = {}, 81 var result = {},
@@ -113,6 +125,7 @@ function searchResult() { @@ -113,6 +125,7 @@ function searchResult() {
113 125
114 // 插入 dom,绑定事件 126 // 插入 dom,绑定事件
115 $('.search-result').html(html); 127 $('.search-result').html(html);
  128 + changeBackground();
116 } 129 }
117 130
118 if ($('.brand-search-page').length) { 131 if ($('.brand-search-page').length) {
@@ -94,6 +94,14 @@ $subNav.each(function () { @@ -94,6 +94,14 @@ $subNav.each(function () {
94 } 94 }
95 }); 95 });
96 96
  97 +// 侧边栏点击背景色变化
  98 +$sideNav.children('ul').children('li').on('touchstart', function() {
  99 + $sideNav.children('ul').children('li').css('background', '#fff');
  100 + $(this).css('background', '#eee');
  101 +}).on('touchend touchcancel', function() {
  102 + $(this).css('background', '#fff');
  103 +});
  104 +
97 //头部banner轮播 105 //头部banner轮播
98 if ($('.banner-swiper').find('li').size() > 1) { 106 if ($('.banner-swiper').find('li').size() > 1) {
99 bannerSwiper = new Swiper('.banner-swiper', { 107 bannerSwiper = new Swiper('.banner-swiper', {
@@ -8,7 +8,8 @@ var $ = require('jquery'); @@ -8,7 +8,8 @@ var $ = require('jquery');
8 var $searchBox = $('.search-box'), 8 var $searchBox = $('.search-box'),
9 $box = $('.box'), 9 $box = $('.box'),
10 $indexSearch = $('.index-search'), 10 $indexSearch = $('.index-search'),
11 - $indexLogo = $('.index-logo'); 11 + $indexLogo = $('.index-logo'),
  12 + $channelLink = $('.index-channel a');
12 13
13 var $search = $searchBox.children('input[type="text"]'), 14 var $search = $searchBox.children('input[type="text"]'),
14 $cancelSearch = $box.children('.no-search'), 15 $cancelSearch = $box.children('.no-search'),
@@ -41,3 +42,22 @@ $searchBox.children('.clear-text').on('touchstart', function() { @@ -41,3 +42,22 @@ $searchBox.children('.clear-text').on('touchstart', function() {
41 $searchBox.children('.search-icon').on('touchstart', function() { 42 $searchBox.children('.search-icon').on('touchstart', function() {
42 $indexSearch.submit(); 43 $indexSearch.submit();
43 }); 44 });
  45 +
  46 +$channelLink.on('touchstart', function() {
  47 + $channelLink.css({
  48 + background: '#000',
  49 + color: '#fff',
  50 + borderColor: '#fff'
  51 + });
  52 + $(this).css({
  53 + background: 'rgba(255, 255, 255, 0.5)',
  54 + color: '#000',
  55 + borderColor: '#000'
  56 + });
  57 +}).on('touchend touchcancel', function() {
  58 + $(this).css({
  59 + background: '#000',
  60 + color: '#fff',
  61 + borderColor: '#fff'
  62 + });
  63 +});