Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
zhangxiaoru
9 years ago
Commit
49f0fa5e36c1fdd9390d7437ca6118dc592cbade
2 parents
0ceb5ce7
8fa597a2
首页
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
103 deletions
static/dist/myohobuy/1.3.17/index-debug.js
static/dist/myohobuy/1.3.17/index.css
static/dist/myohobuy/1.3.17/index.js
static/dist/myohobuy/assets/img/sprite.product.png
static/dist/myohobuy/1.3.17/index-debug.js
View file @
49f0fa5
...
...
@@ -8497,13 +8497,13 @@ var $listNav = $('#list-nav'),
new
:
{
order
:
1
,
reload
:
true
,
page
:
0
,
page
:
1
,
end
:
false
},
hot
:
{
order
:
1
,
reload
:
true
,
page
:
0
,
page
:
1
,
end
:
false
},
newest
:
{
...
...
@@ -8529,7 +8529,7 @@ var $listNav = $('#list-nav'),
searching
;
var
viewType
=
1
;
// 1-首页,2-上新,3-人气
lazyLoad
(
$
(
'img.lazy'
));
//焦点效果
if
(
$
(
'.banner-swiper'
).
find
(
'li'
).
size
()
>
1
)
{
bannerSwiper
=
new
Swiper
(
'.banner-swiper'
,
{
...
...
@@ -8545,7 +8545,7 @@ if ($('.banner-swiper').find('li').size() > 1) {
}
if
(
$
(
'.multi-browse'
).
find
(
'li'
).
size
()
>
1
)
{
multiSwiper
=
new
Swiper
(
'.multi-browse'
,
{
multiSwiper
=
new
Swiper
(
'.multi-browse'
,
{
lazyLoading
:
true
,
lazyLoadingInPrevNext
:
true
,
lazyLoadingOnTransitionStart
:
true
,
...
...
@@ -8566,7 +8566,7 @@ function getPageGoods(info) {
url
:
info
.
url
,
data
:
info
.
data
,
success
:
function
(
data
)
{
info
.
callBack
(
data
);
info
.
callBack
(
data
);
},
error
:
function
()
{
alert
(
'网络断开连接了~'
);
...
...
@@ -8582,21 +8582,19 @@ function newData(callback) {
req
.
data
=
{
type
:
'newest'
,
order
:
'1'
,
page
:
'1'
,
page
:
navInfo
.
new
.
page
,
shop_id
:
$shopId
};
req
.
callBack
=
function
(
data
)
{
$
(
'#new-arrival'
).
append
(
data
);
navInfo
.
new
.
page
++
;
myScroll
.
refresh
();
lazyLoad
(
$
(
'img.lazy'
));
$
(
"#scroller"
).
trigger
(
'scroll'
);
lazyLoad
(
$
(
'#new-arrival .lazy'
));
scH
=
$
(
'#scroller'
).
outerHeight
();
searching
=
false
;
callback
&&
$
.
isFunction
(
callback
)
&&
callback
();
}
getPageGoods
(
req
);
};
getPageGoods
(
req
);
}
function
hotData
(
callback
)
{
...
...
@@ -8606,19 +8604,18 @@ function hotData(callback) {
req
.
data
=
{
type
:
'sales'
,
order
:
'1'
,
page
:
'1'
,
page
:
navInfo
.
hot
.
page
,
shop_id
:
$shopId
};
req
.
callBack
=
function
(
data
)
{
$
(
'#popularity'
).
append
(
data
);
navInfo
.
hot
.
page
++
;
myScroll
.
refresh
();
lazyLoad
(
$
(
'img.lazy'
));
$
(
"#scroller"
).
trigger
(
'scroll'
);
lazyLoad
(
$
(
'#popularity .lazy'
));
scH
=
$
(
'#scroller'
).
outerHeight
();
searching
=
false
;
callback
&&
$
.
isFunction
(
callback
)
&&
callback
();
}
}
;
getPageGoods
(
req
);
}
...
...
@@ -8641,71 +8638,64 @@ $.jqtab = function(nav, posNav, main) {
activeTab
=
$
(
this
).
attr
(
'tab'
);
$nav1
.
removeClass
(
'fixed-top'
);
tabChange
(
$
(
nav
+
' li'
),
index
);
tabChange
(
$
(
posNav
+
' li'
),
index
);
$
(
main
).
hide
();
$
(
'#'
+
activeTab
).
fadeIn
();
if
(
activeTab
===
'new-arrival'
){
if
(
activeTab
===
'new-arrival'
)
{
newData
();
viewType
=
2
;
}
else
if
(
activeTab
===
'popularity'
)
{
}
else
if
(
activeTab
===
'popularity'
)
{
hotData
();
viewType
=
2
;
viewType
=
3
;
}
else
if
(
activeTab
===
'home-page'
)
{
myScroll
&&
myScroll
.
refresh
();
scH
=
$
(
'#scroller'
).
outerHeight
();
$nav1
.
removeClass
(
'fixed-top'
);
$nav1
.
removeClass
(
'absolute'
);
$nav2
.
removeClass
(
'fixed-top'
);
$nav2
.
removeClass
(
'absolute'
);
}
myScroll
.
scrollTo
(
0
,
0
);
myScroll
.
scrollTo
(
0
,
0
);
$nav1
.
addClass
(
'hide'
);
return
false
;
});
};
$
.
jqtab
(
'#nav'
,
'#pos-nav'
,
'.main'
);
$
.
jqtab
(
'#nav'
,
'#pos-nav'
,
'.main'
);
$
(
'#wrapper'
).
addClass
(
'scroll-wrapper'
);
lazyLoad
(
$
(
'img.lazy'
));
// lazyLoad($('img.lazy'));
myScroll
=
new
IScroll
(
'#wrapper'
,
{
probeType
:
3
,
mouseWheel
:
true
,
mouseWheel
:
true
,
click
:
true
});
myScroll
.
on
(
'scroll'
,
function
()
{
sTop
=
-
this
.
y
;
var
scrollCall
,
sTop
=
-
this
.
y
;
if
(
sTop
+
winH
*
2
>
scH
)
{
switch
(
viewType
)
{
switch
(
viewType
)
{
case
2
:
var
scrollCall
=
function
()
{
scrollCall
=
function
()
{
$nav1
.
css
({
transform
:
'translate(0, '
+
(
-
scH
)
+
'px)'
transform
:
'translate(0, '
+
(
-
scH
)
+
'px)'
});
}
newData
(
scrollCall
);
};
newData
(
scrollCall
);
break
;
case
3
:
var
scrollCall
=
function
()
{
scrollCall
=
function
()
{
$nav1
.
css
({
transform
:
'translate(0, '
+
(
-
scH
)
+
'px)'
transform
:
'translate(0, '
+
(
-
scH
)
+
'px)'
});
}
}
;
hotData
(
scrollCall
);
break
;
}
}
if
(
sTop
<
imgH
)
{
if
(
!
$nav1
.
hasClass
(
'hide'
))
{
$nav1
.
addClass
(
'hide'
);
...
...
@@ -8726,20 +8716,19 @@ myScroll.on('scroll', function() {
$nav1
.
addClass
(
'fixed-top'
)
.
removeClass
(
'absolute'
)
.
css
({
transform
:
'translate(0, '
+
(
-
scH
)
+
'px)'
transform
:
'translate(0, '
+
(
-
scH
)
+
'px)'
});
}
}
else
if
(
sTop
<
imgH
+
nav1H
+
main1H
)
{
if
(
$
(
'#home-page'
).
is
(
':hidden'
))
{
return
false
;
}
if
(
!
$nav1
.
hasClass
(
'absolute'
))
{
$nav1
.
addClass
(
'absolute'
)
.
removeClass
(
'fixed-top'
);
}
$nav1
.
css
({
transform
:
'translate(0, '
+
(
imgH
+
main1H
-
sTop
-
scH
)
+
'px)'
transform
:
'translate(0, '
+
(
imgH
+
main1H
-
sTop
-
scH
)
+
'px)'
});
}
}
else
{
...
...
@@ -8759,12 +8748,12 @@ myScroll.on('scroll', function() {
$nav2
.
addClass
(
'fixed-top'
)
.
removeClass
(
'absolute'
)
.
css
({
transform
:
'translate(0, '
+
(
-
scH
)
+
'px)'
transform
:
'translate(0, '
+
(
-
scH
)
+
'px)'
});
}
}
}
$
(
"#scroller"
).
trigger
(
'scroll'
);
$
(
'#scroller'
).
trigger
(
'scroll'
);
});
...
...
@@ -8787,9 +8776,9 @@ $(window).load(function() {
main1oH
=
$
(
'#nav-main'
).
outerHeight
();
nav2H
=
$
(
'#list-nav'
).
outerHeight
();
main2oH
=
$
(
'#goods-container'
).
outerHeight
();
setTimeout
(
function
(){
setTimeout
(
function
()
{
scH
=
$
(
'#scroller'
).
outerHeight
();
},
1000
);
},
1000
);
});
...
...
@@ -8814,7 +8803,7 @@ function search(opt) {
}
switch
(
opt
.
type
)
{
case
'shop_id'
:
case
'shop_id'
:
ext
=
{
shop_id
:
opt
.
id
};
...
...
@@ -8879,7 +8868,7 @@ function search(opt) {
//不需要重新加载并且数据请求结束
return
;
}
console
.
log
(
page
)
$
.
extend
(
setting
,
defaultOpt
,
{
type
:
navType
,
order
:
nav
.
order
,
...
...
@@ -8936,13 +8925,11 @@ function search(opt) {
window
.
rePosFooter
();
setTimeout
(
function
()
{
setTimeout
(
function
()
{
myScroll
.
refresh
();
scH
=
$
(
'#scroller'
).
outerHeight
();
},
1000
);
},
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
searching
=
false
;
...
...
@@ -8958,12 +8945,10 @@ $.ajax({
success
:
function
(
data
)
{
$goodsContainer
.
append
(
data
);
setTimeout
(
function
()
{
myScroll
.
refresh
();
scH
=
$
(
'#scroller'
).
outerHeight
();
},
1000
);
setTimeout
(
function
()
{
myScroll
.
refresh
();
scH
=
$
(
'#scroller'
).
outerHeight
();
},
1000
);
//初始化filter&注册filter回调
filter
.
initFilter
({
...
...
@@ -9093,17 +9078,16 @@ $subNav.on('touchend touchcancel', function(e) {
function
scrollHandler
()
{
//当scroll到1/4$goodsContainer高度后继续请求下一页数据
myScroll
&&
myScroll
.
refresh
();
if
(
sTop
+
winH
>
$
(
'#scroller'
).
height
()
-
0.25
*
$goodsContainer
.
height
()
-
50
){
if
(
sTop
+
winH
>
$
(
'#scroller'
).
height
()
-
0.25
*
$goodsContainer
.
height
()
-
50
)
{
if
(
$pre
!==
undefined
)
{
search
({
type
:
'shop_id'
,
id
:
$shopId
,
url
:
'/index/search/search'
});
});
}
}
}
...
...
@@ -9118,59 +9102,50 @@ search({
type
:
'shop_id'
,
id
:
$shopId
,
url
:
'/index/search/search'
}
);
});
$listNav
.
on
(
'touchstart'
,
'li'
,
function
(
e
)
{
$
(
this
).
addClass
(
'bytouch'
);
}).
on
(
'touchend touchcancel'
,
function
()
{
$listNav
.
find
(
'li'
).
removeClass
(
'bytouch'
);
myScroll
.
refresh
();
if
(
sTop
>
imgH
+
nav1H
+
main1oH
)
{
myScroll
.
scrollTo
(
0
,
-
(
imgH
+
nav1H
+
main1oH
+
10
));
}
});
});
$posList
.
on
(
'touchstart'
,
'li'
,
function
(
e
)
{
$
(
this
).
addClass
(
'bytouch'
);
}).
on
(
'touchend touchcancel'
,
function
()
{
$posList
.
find
(
'li'
).
removeClass
(
'bytouch'
);
myScroll
.
refresh
();
if
(
sTop
>
imgH
+
nav1H
+
main1oH
)
{
myScroll
.
scrollTo
(
0
,
-
(
imgH
+
nav1H
+
main1oH
+
10
));
}
myScroll
.
refresh
();
myScroll
.
scrollTo
(
0
,
-
(
imgH
+
nav1H
+
main1oH
+
5
));
});
//底部导航点击
function
fotterClick
(
group
)
{
$
(
group
+
' li'
).
on
(
'touchstart'
,
function
()
{
$
(
'.sub-group'
).
addClass
(
'hide'
);
if
(
$
(
this
).
find
(
'.sub-group'
).
length
>
0
){
$
(
this
).
find
(
'.sub-group'
).
removeClass
(
'hide'
);
}
});
};
$
(
group
+
' li'
).
on
(
'touchstart'
,
function
()
{
$
(
'.sub-group'
).
addClass
(
'hide'
);
if
(
$
(
this
).
find
(
'.sub-group'
).
length
>
0
)
{
$
(
this
).
find
(
'.sub-group'
).
removeClass
(
'hide'
);
}
});
}
fotterClick
(
'.shop-foot-wrapper'
);
function
stopPropagation
(
e
)
{
if
(
e
.
stopPropagation
){
e
.
stopPropagation
();
}
else
{
e
.
cancelBubble
=
true
;
}
}
function
stopPropagation
(
e
)
{
if
(
e
.
stopPropagation
)
{
e
.
stopPropagation
();
}
else
{
e
.
cancelBubble
=
true
;
}
}
$
(
document
).
bind
(
'touchstart'
,
function
(){
$
(
'.sub-group'
).
addClass
(
'hide'
);
});
$
(
document
).
bind
(
'touchstart'
,
function
()
{
$
(
'.sub-group'
).
addClass
(
'hide'
);
});
$
(
'.shop-foot-wrapper'
).
bind
(
'touchstart'
,
function
(
e
){
stopPropagation
(
e
);
});
$
(
'.shop-foot-wrapper'
).
bind
(
'touchstart'
,
function
(
e
)
{
stopPropagation
(
e
);
});
//收藏
function
postCollect
(
info
)
{
...
...
@@ -9188,10 +9163,10 @@ function postCollect(info) {
success
:
function
(
data
)
{
if
(
data
.
code
===
200
){
if
(
data
.
code
===
200
)
{
if
(
$
(
'#collect'
).
hasClass
(
'alreadyCollect'
))
{
$
(
'#collect'
).
attr
(
'class'
,
'notCollect'
);
}
else
{
}
else
{
$
(
'#collect'
).
attr
(
'class'
,
'alreadyCollect'
);
}
}
...
...
@@ -9203,11 +9178,10 @@ function postCollect(info) {
$
(
'.jump-login'
).
click
();
}
setTimeout
(
function
()
{
setTimeout
(
function
()
{
myScroll
.
refresh
();
scH
=
$
(
'#scroller'
).
outerHeight
();
},
1000
);
searching
=
false
;
},
error
:
function
()
{
...
...
@@ -9241,11 +9215,11 @@ function cancelShop() {
$
(
'#collect'
).
bind
(
'touchstart'
,
function
()
{
if
(
$
(
'#collect'
).
hasClass
(
'alreadyCollect'
))
{
cancelShop
();
}
else
{
cancelShop
();
}
else
{
collectShop
();
}
});
});
...
...
static/dist/myohobuy/1.3.17/index.css
View file @
49f0fa5
This diff could not be displayed because it is too large.
static/dist/myohobuy/1.3.17/index.js
View file @
49f0fa5
This diff could not be displayed because it is too large.
static/dist/myohobuy/assets/img/sprite.product.png
0 → 100644
View file @
49f0fa5
8.82 KB
Please
register
or
login
to post a comment