Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
4 changed files
with
34 additions
and
61 deletions
@@ -10,24 +10,12 @@ var $searchBox = $('.search-box'), | @@ -10,24 +10,12 @@ var $searchBox = $('.search-box'), | ||
10 | $box = $('.box'), | 10 | $box = $('.box'), |
11 | $indexSearch = $('.index-search'), | 11 | $indexSearch = $('.index-search'), |
12 | $indexLogo = $('.index-logo'), | 12 | $indexLogo = $('.index-logo'), |
13 | - $channelLink = $('.index-channel a'), | ||
14 | - $win = $(window), | ||
15 | - $doc = $(document), | ||
16 | - $appFloatLayer = $('#float-layer-app'); | 13 | + $channelLink = $('.index-channel a'); |
17 | 14 | ||
18 | var $search = $searchBox.children('input[type="text"]'), | 15 | var $search = $searchBox.children('input[type="text"]'), |
19 | $cancelSearch = $box.children('.no-search'), | 16 | $cancelSearch = $box.children('.no-search'), |
20 | $searchIcon = $searchBox.children('.search-icon'); | 17 | $searchIcon = $searchBox.children('.search-icon'); |
21 | 18 | ||
22 | -// variables for calculate the app download layer position | ||
23 | -var layerInit = false, | ||
24 | - windowViewHeight = 0, | ||
25 | - layerContentHeight = $appFloatLayer.height(), | ||
26 | - layerPaddingTop = parseInt($appFloatLayer.css('padding-top')), | ||
27 | - layerPaddingBottom = parseInt($appFloatLayer.css('padding-bottom')), | ||
28 | - layerHeight = layerContentHeight + layerPaddingTop + layerPaddingBottom, | ||
29 | - layerNewPos; | ||
30 | - | ||
31 | require('../common'); | 19 | require('../common'); |
32 | 20 | ||
33 | $search.on('focus', function() { | 21 | $search.on('focus', function() { |
@@ -59,6 +47,15 @@ $searchBox.children('.search-icon').on('touchstart', function() { | @@ -59,6 +47,15 @@ $searchBox.children('.search-icon').on('touchstart', function() { | ||
59 | $indexSearch.submit(); | 47 | $indexSearch.submit(); |
60 | }); | 48 | }); |
61 | 49 | ||
50 | +$searchBox.keyup(function(e) { | ||
51 | + if (e.keyCode === 13) { | ||
52 | + if (security.hasDangerInput()) { | ||
53 | + return false; | ||
54 | + } | ||
55 | + $indexSearch.submit(); | ||
56 | + } | ||
57 | +}); | ||
58 | + | ||
62 | $('.index-channel img').on('load error', function() { | 59 | $('.index-channel img').on('load error', function() { |
63 | window.rePosFooter && window.rePosFooter(); | 60 | window.rePosFooter && window.rePosFooter(); |
64 | }); | 61 | }); |
@@ -81,40 +78,3 @@ $channelLink.on('touchstart', function() { | @@ -81,40 +78,3 @@ $channelLink.on('touchstart', function() { | ||
81 | borderColor: '#fff' | 78 | borderColor: '#fff' |
82 | }); | 79 | }); |
83 | }); | 80 | }); |
84 | - | ||
85 | - | ||
86 | -function updateLayerPosition() { | ||
87 | - var winHeight = window.innerHeight, | ||
88 | - bodyHeight = $doc.height(), | ||
89 | - scrollTopPosition = $win.scrollTop(); | ||
90 | - | ||
91 | - if (layerInit) { | ||
92 | - | ||
93 | - //keyboard is shown | ||
94 | - if (windowViewHeight - winHeight > 200) { | ||
95 | - if (scrollTopPosition + windowViewHeight + layerHeight >= bodyHeight) { | ||
96 | - layerNewPos = 0; | ||
97 | - } else { | ||
98 | - layerNewPos = bodyHeight - windowViewHeight - scrollTopPosition - layerHeight; | ||
99 | - } | ||
100 | - } else { | ||
101 | - layerNewPos = bodyHeight - winHeight - scrollTopPosition; | ||
102 | - } | ||
103 | - | ||
104 | - } else { | ||
105 | - windowViewHeight = winHeight; | ||
106 | - layerNewPos = bodyHeight - winHeight - scrollTopPosition + layerHeight; | ||
107 | - layerInit = true; | ||
108 | - } | ||
109 | - | ||
110 | - $appFloatLayer.css({ | ||
111 | - position: 'relative', | ||
112 | - bottom: layerNewPos + 'px' | ||
113 | - }); | ||
114 | -} | ||
115 | - | ||
116 | -$(window).scroll(function() { | ||
117 | - window.requestAnimationFrame(updateLayerPosition); | ||
118 | -}); | ||
119 | - | ||
120 | -$doc.on('ready', updateLayerPosition); |
@@ -12,7 +12,6 @@ var diaLog = require('./dialog'); | @@ -12,7 +12,6 @@ var diaLog = require('./dialog'); | ||
12 | 12 | ||
13 | var $navLi = $('#fav-tab > li'), | 13 | var $navLi = $('#fav-tab > li'), |
14 | $favContainer = $('.fav-content > .fav-type'), | 14 | $favContainer = $('.fav-content > .fav-type'), |
15 | - $swiperList = '', | ||
16 | swiperObj = {}, | 15 | swiperObj = {}, |
17 | favTabHammer, | 16 | favTabHammer, |
18 | favContentHammer, | 17 | favContentHammer, |
@@ -37,22 +36,30 @@ function showFavTab(index) { | @@ -37,22 +36,30 @@ function showFavTab(index) { | ||
37 | } | 36 | } |
38 | 37 | ||
39 | //初始化swiper | 38 | //初始化swiper |
40 | -function initSwiper() { | 39 | +function initSwiper(data) { |
41 | var i, | 40 | var i, |
42 | - id; | 41 | + idStrReg = /container-(\d+)['"]{1}/gi, |
42 | + idReg = /\d+/, | ||
43 | + idArr = data.match(idStrReg), | ||
44 | + idArrLen = idArr.length, | ||
45 | + containerId; | ||
43 | 46 | ||
44 | - $swiperList = $('.swiper-container'); | ||
45 | - for (i = 0; i < $swiperList.length; i++) { | ||
46 | - id = $swiperList.eq(i).attr('data-id'); | 47 | + //$swiperList = $('.swiper-container'); |
48 | + for (i = 0; i < idArrLen; i++) { | ||
49 | + | ||
50 | + /*id = $swiperList.eq(i).attr('data-id'); | ||
47 | 51 | ||
48 | if (!!swiperObj[id]) { | 52 | if (!!swiperObj[id]) { |
49 | swiperObj[id].destroy(true, true); | 53 | swiperObj[id].destroy(true, true); |
50 | - } | ||
51 | - swiperObj[id] = new Swiper('#swiper-container-' + id, { | 54 | + }*/ |
55 | + | ||
56 | + containerId = idArr[i].match(idReg)[0]; | ||
57 | + | ||
58 | + swiperObj[containerId] = new Swiper('#swiper-container-' + containerId, { | ||
52 | slidesPerView: 'auto', | 59 | slidesPerView: 'auto', |
53 | grabCursor: true, | 60 | grabCursor: true, |
54 | slideElement: 'li', | 61 | slideElement: 'li', |
55 | - wrapperClass: 'swiper-wrapper-' + id, | 62 | + wrapperClass: 'swiper-wrapper-' + containerId, |
56 | lazyLoading: true, | 63 | lazyLoading: true, |
57 | watchSlidesVisibility: true | 64 | watchSlidesVisibility: true |
58 | }); | 65 | }); |
@@ -93,7 +100,7 @@ function loadData($parent, url, page) { | @@ -93,7 +100,7 @@ function loadData($parent, url, page) { | ||
93 | $parent.append(data); | 100 | $parent.append(data); |
94 | $parent.closest('.fav-type').find('.fav-content-loading').remove(); | 101 | $parent.closest('.fav-type').find('.fav-content-loading').remove(); |
95 | if (url === 'favBrand') { | 102 | if (url === 'favBrand') { |
96 | - initSwiper();//如果是收藏品牌需要初始化swiper | 103 | + initSwiper(data);//如果是收藏品牌需要初始化swiper |
97 | 104 | ||
98 | brandLockId = false;//请求成功后解锁品牌收藏page++ | 105 | brandLockId = false;//请求成功后解锁品牌收藏page++ |
99 | } else { | 106 | } else { |
@@ -39,7 +39,7 @@ $('#upload-img').uploadifive({ | @@ -39,7 +39,7 @@ $('#upload-img').uploadifive({ | ||
39 | fileType: 'image*/*', | 39 | fileType: 'image*/*', |
40 | uploadScript: '/home/suggestimgUpload', | 40 | uploadScript: '/home/suggestimgUpload', |
41 | fileObjName: 'fileData', | 41 | fileObjName: 'fileData', |
42 | - fileSizeLimit: 1024, | 42 | + fileSizeLimit: 300, |
43 | height: '100%', | 43 | height: '100%', |
44 | width: '100%', | 44 | width: '100%', |
45 | multi: false, | 45 | multi: false, |
-
Please register or login to post a comment