Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Showing
5 changed files
with
26 additions
and
13 deletions
framework @ 75bbc3b0
@@ -10,6 +10,7 @@ var $ = require('jquery'), | @@ -10,6 +10,7 @@ var $ = require('jquery'), | ||
10 | lazyLoad = require('yoho.lazyload'); | 10 | lazyLoad = require('yoho.lazyload'); |
11 | 11 | ||
12 | var swiper, | 12 | var swiper, |
13 | + $fixTitleBar, | ||
13 | $brandText, | 14 | $brandText, |
14 | $brandHref, | 15 | $brandHref, |
15 | $brandList = $('.brand-list'); | 16 | $brandList = $('.brand-list'); |
@@ -40,21 +41,30 @@ $('.yoho-header').css({ | @@ -40,21 +41,30 @@ $('.yoho-header').css({ | ||
40 | top: 0 | 41 | top: 0 |
41 | }); | 42 | }); |
42 | 43 | ||
44 | +$fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>'); | ||
45 | +$fixTitleBar.hide(); | ||
46 | +$('.brand-list').last().append($fixTitleBar); | ||
47 | + | ||
43 | $(window).scroll(function() { | 48 | $(window).scroll(function() { |
44 | - var scrTop = $(window).scrollTop(); | 49 | + var scrTop = $(window).scrollTop(), |
50 | + minBrandListTop = brandSwipe + $('.hot-brand').outerHeight() + | ||
51 | + $('.banner-top').outerHeight(); | ||
52 | + | ||
53 | + if ($brandList.eq(0).offset().top < minBrandListTop) { | ||
54 | + $fixTitleBar.hide(); | ||
55 | + } | ||
45 | 56 | ||
46 | - $('.brand-list').each(function() { | 57 | + $brandList.each(function() { |
47 | var offTop = $(this).offset().top - brandSwipe; | 58 | var offTop = $(this).offset().top - brandSwipe; |
48 | 59 | ||
49 | if (scrTop >= offTop) { | 60 | if (scrTop >= offTop) { |
50 | - $brandList.find('.title-bar').css('position', 'static'); | ||
51 | - $(this).find('.title-bar').css({ | 61 | + $fixTitleBar.css({ |
62 | + display: 'block', | ||
52 | position: 'fixed', | 63 | position: 'fixed', |
53 | top: brandSwipe | 64 | top: brandSwipe |
54 | - }); | ||
55 | - } else { | ||
56 | - $(this).find('.title-bar').css('position', 'static'); | 65 | + }).find('h2').html($(this).find('.title-bar').text()); |
57 | } | 66 | } |
67 | + | ||
58 | }); | 68 | }); |
59 | }); | 69 | }); |
60 | 70 |
@@ -4,10 +4,13 @@ | @@ -4,10 +4,13 @@ | ||
4 | * @date: 2015/10/28 | 4 | * @date: 2015/10/28 |
5 | */ | 5 | */ |
6 | var $ = require('jquery'); | 6 | var $ = require('jquery'); |
7 | + | ||
7 | var $searchBox = $('.search-box'), | 8 | var $searchBox = $('.search-box'), |
8 | $indexSearch = $('.index-search'), | 9 | $indexSearch = $('.index-search'), |
9 | $indexLogo = $('.index-logo'); | 10 | $indexLogo = $('.index-logo'); |
10 | 11 | ||
12 | +require('../common'); | ||
13 | + | ||
11 | function showBigSearch() { | 14 | function showBigSearch() { |
12 | $indexLogo.css({ | 15 | $indexLogo.css({ |
13 | opacity: 0 | 16 | opacity: 0 |
@@ -50,4 +53,4 @@ $('.no-search').on('touchend', function() { | @@ -50,4 +53,4 @@ $('.no-search').on('touchend', function() { | ||
50 | hideBigSearch(); | 53 | hideBigSearch(); |
51 | }); | 54 | }); |
52 | 55 | ||
53 | -window.rePosFooter(); | 56 | +window.rePosFooter && window.rePosFooter(); |
@@ -185,9 +185,8 @@ | @@ -185,9 +185,8 @@ | ||
185 | .search-result { | 185 | .search-result { |
186 | padding-top: 176rem / $pxConvertRem; | 186 | padding-top: 176rem / $pxConvertRem; |
187 | } | 187 | } |
188 | -} | ||
189 | 188 | ||
190 | -.history{ | 189 | + .history{ |
191 | width: 100%; | 190 | width: 100%; |
192 | height: auto; | 191 | height: auto; |
193 | overflow: hidden; | 192 | overflow: hidden; |
@@ -231,5 +230,5 @@ | @@ -231,5 +230,5 @@ | ||
231 | margin-left: .6rem; | 230 | margin-left: .6rem; |
232 | color: #000; | 231 | color: #000; |
233 | } | 232 | } |
233 | + } | ||
234 | } | 234 | } |
235 | - |
@@ -17,14 +17,15 @@ | @@ -17,14 +17,15 @@ | ||
17 | overflow: hidden; | 17 | overflow: hidden; |
18 | 18 | ||
19 | .brand-logo { | 19 | .brand-logo { |
20 | + display: table-cell; | ||
20 | width: 100%; | 21 | width: 100%; |
21 | height: 128rem / $pxConvertRem; | 22 | height: 128rem / $pxConvertRem; |
22 | line-height: 128rem / $pxConvertRem; | 23 | line-height: 128rem / $pxConvertRem; |
23 | text-align: center; | 24 | text-align: center; |
24 | font-size: 0; | 25 | font-size: 0; |
26 | + vertical-align: middle; | ||
25 | 27 | ||
26 | img { | 28 | img { |
27 | - vertical-align: middle; | ||
28 | max-width: 100%; | 29 | max-width: 100%; |
29 | max-height: 100%; | 30 | max-height: 100%; |
30 | } | 31 | } |
-
Please register or login to post a comment