Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOOD
·
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
whb
10 years ago
Commit
a5608335e236093e875ff513ebe98a2818b3ee2b
2 parents
79a9b7c4
3c45ef9c
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohood.git
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
87 deletions
res/js/mobile.js
res/js/mobile.js
View file @
a560833
...
...
@@ -31,30 +31,32 @@ define('mobile', function(require, exports) {
}
}
});
if
(
store
.
get
(
'download_state'
))
{
$
(
'.header-download-wrap'
).
remove
();
if
(
store
.
get
(
'download_state'
))
{
$
(
'.header-download-wrap'
).
remove
();
}
else
{
$
(
'.header-download-wrap'
).
show
();
$
(
'.header-download-wrap'
).
show
();
}
//关闭下载
$
(
'.header-download-wrap'
).
on
(
'click'
,
'.tip-close'
,
function
()
{
$
(
'.header-download-wrap'
).
remove
();
store
.
set
(
'download_state'
,
1
);
store
.
set
(
'download_state'
,
1
);
});
}
};
exports
.
index
=
function
()
{
var
bannerSwiper
;
bannerSwiper
=
new
swiper
(
'.slide-box'
,
{
wrapperClass
:
'slide-wrap'
,
slideClass
:
'box'
,
autoplay
:
5000
,
loop
:
true
,
pagination
:
'.slide-navigator .dib'
,
paginationElement
:
'a'
,
autoplayDisableOnInteraction
:
false
});
if
(
$
(
'.slide-box'
).
find
(
'.box'
).
size
()
>
1
)
{
bannerSwiper
=
new
swiper
(
'.slide-box'
,
{
wrapperClass
:
'slide-wrap'
,
slideClass
:
'box'
,
autoplay
:
5000
,
loop
:
true
,
pagination
:
'.slide-navigator .dib'
,
paginationElement
:
'a'
,
autoplayDisableOnInteraction
:
false
});
}
if
(
$
(
'.slide-navigator .dib'
).
find
(
'a'
).
size
()
<=
1
)
{
$
(
'.slide-navigator'
).
hide
();
}
...
...
@@ -174,7 +176,7 @@ define('mobile', function(require, exports) {
detailSubtitle
=
$
(
'.detail-title'
).
find
(
'.subtitle'
),
slideSwiper
;
mlellipsis
.
init
();
//多图滑动
if
(
$
(
'.slide-box'
).
find
(
'.box'
).
size
()
>
1
)
{
slideSwiper
=
new
swiper
(
'.slide-box'
,
{
...
...
@@ -212,17 +214,19 @@ define('mobile', function(require, exports) {
});
var
videoSize
=
$
(
"video"
).
size
();
var
videoPos
=
0
;
if
(
videoSize
>
0
)
{
if
(
videoSize
>
0
)
{
var
videoInterval
=
setInterval
(
function
()
{
$
(
"video"
).
each
(
function
()
{
//设置视频高度
if
(
$
(
this
)[
0
].
videoHeight
>
0
)
{
$
(
this
).
css
({
"height"
:
Math
.
floor
(
$
(
this
)[
0
].
videoHeight
*
(
300
/
$
(
this
)[
0
].
videoWidth
))
});
videoPos
++
;
}
});
if
(
videoPos
>=
videoSize
)
clearInterval
(
videoInterval
);
},
20
);
function
()
{
$
(
"video"
).
each
(
function
()
{
//设置视频高度
if
(
$
(
this
)[
0
].
videoHeight
>
0
)
{
$
(
this
).
css
({
"height"
:
Math
.
floor
(
$
(
this
)[
0
].
videoHeight
*
(
300
/
$
(
this
)[
0
].
videoWidth
))
});
videoPos
++
;
}
});
if
(
videoPos
>=
videoSize
)
clearInterval
(
videoInterval
);
},
20
);
}
};
...
...
@@ -258,72 +262,67 @@ define('mobile', function(require, exports) {
window
.
location
.
href
=
$
(
this
).
val
();
});
var
current_tag
=
$
(
".main-layout"
).
attr
(
"current_tag"
);
var
url
=
current_tag
==
""
?
"/news/index"
:
"/news/index/tag/"
+
current_tag
;
var
url
=
current_tag
==
""
?
"/news/index"
:
"/news/index/tag/"
+
current_tag
;
var
prevPage
=
'<a href="{url}"><span class="iconfont"></span> PREV</a>'
;
var
lastPage
=
'<a href="{url}" class="next">NEXT <span class="iconfont"></span></a>'
;
var
pageHtml
=
'<div id="pageContent" style="text-align: center;" class="pagination">'
+
'<div class="pagination-inner clearfix" id="img_page" model="default" rel="">{prevPage}{lastPage}</div></div>'
;
var
pageHtml
=
'<div id="pageContent" style="text-align: center;" class="pagination">'
+
'<div class="pagination-inner clearfix" id="img_page" model="default" rel="">{prevPage}{lastPage}</div></div>'
;
var
getPagination
=
function
(
page
,
totalPage
)
{
if
(
$
(
"#pageContent"
).
size
()
>
0
)
{
return
""
}
if
(
page
-
1
>=
1
)
{
prevPage
=
prevPage
.
replace
(
"{url}"
,
url
+
"/page/"
+
((
page
-
1
)
*
4
-
3
));
pageHtml
=
pageHtml
.
replace
(
"{prevPage}"
,
prevPage
);
}
if
(
page
<
totalPage
)
{
lastPage
=
lastPage
.
replace
(
"{url}"
,
url
+
"/page/"
+
(
page
*
4
+
1
)
);
pageHtml
=
pageHtml
.
replace
(
"{lastPage}"
,
lastPage
);
}
if
(
page
<
1
)
{
pageHtml
=
''
;
}
pageHtml
=
pageHtml
.
replace
(
"{prevPage}"
,
""
).
replace
(
"{lastPage}"
,
""
);
return
pageHtml
;
if
(
$
(
"#pageContent"
).
size
()
>
0
)
{
return
""
}
if
(
page
-
1
>=
1
)
{
prevPage
=
prevPage
.
replace
(
"{url}"
,
url
+
"/page/"
+
((
page
-
1
)
*
4
-
3
));
pageHtml
=
pageHtml
.
replace
(
"{prevPage}"
,
prevPage
);
}
if
(
page
<
totalPage
)
{
lastPage
=
lastPage
.
replace
(
"{url}"
,
url
+
"/page/"
+
(
page
*
4
+
1
));
pageHtml
=
pageHtml
.
replace
(
"{lastPage}"
,
lastPage
);
}
if
(
page
<
1
)
{
pageHtml
=
''
;
}
pageHtml
=
pageHtml
.
replace
(
"{prevPage}"
,
""
).
replace
(
"{lastPage}"
,
""
);
return
pageHtml
;
}
$
(
window
).
bind
(
"scroll"
,
function
()
{
var
total
=
$
(
".main-layout"
).
attr
(
"total"
);
var
ajaxPage
=
$
(
".main-layout"
).
attr
(
"page"
);
//ajax请求的page
var
total_times
=
parseInt
(
$
(
".main-layout"
).
attr
(
"total_times"
));
var
limit
=
parseInt
(
$
(
".main-layout"
).
attr
(
"limit"
));
var
times
=
$
(
".main-layout"
).
attr
(
"times"
)
?
$
(
".main-layout"
).
attr
(
"times"
)
:
0
;
var
page
=
Math
.
ceil
(
parseInt
(
ajaxPage
)
/
(
total_times
+
1
));
var
totalPage
=
Math
.
ceil
(
total
/
(
limit
*
(
total_times
+
1
)));
if
(
$
(
window
).
scrollTop
()
>=
$
(
document
).
height
()
-
$
(
window
).
height
()
-
50
)
{
if
(
total
>
limit
&&
times
<
total_times
&&
page
<=
totalPage
)
{
$
.
ajax
({
type
:
"get"
,
url
:
url
+
"/page/"
+
(
parseInt
(
ajaxPage
)
+
1
),
success
:
function
(
data
)
{
var
news_page
=
$
(
data
);
if
(
$
(
".main-layout"
).
attr
(
"page"
)
!=
news_page
.
attr
(
"page"
)
&&
news_page
.
html
()
!=
""
)
{
$
(
".main-layout"
).
append
(
news_page
.
html
());
$
(
".main-layout"
).
attr
({
"total"
:
news_page
.
attr
(
"total"
),
"page"
:
news_page
.
attr
(
"page"
),
"times"
:
++
times
});
// console.log(news_page.attr("page"));
// console.log("times:" + times);
}
page
=
Math
.
ceil
(
parseInt
(
news_page
.
attr
(
"page"
))
/
(
total_times
+
1
));
//实现页码
// console.log("page:" + page);
// console.log("totalPage:" + totalPage);
if
(
times
==
total_times
||
news_page
.
html
()
==
""
||
page
==
totalPage
)
{
$
(
".main-layout"
).
append
(
getPagination
(
page
,
totalPage
));
}
}
});
}
else
if
(
page
==
totalPage
)
{
$
(
".main-layout"
).
append
(
getPagination
(
page
,
totalPage
));
}
return
false
;
}
$
(
window
).
bind
(
"scroll"
,
function
()
{
var
total
=
$
(
".main-layout"
).
attr
(
"total"
);
var
ajaxPage
=
$
(
".main-layout"
).
attr
(
"page"
);
//ajax请求的page
var
total_times
=
parseInt
(
$
(
".main-layout"
).
attr
(
"total_times"
));
var
limit
=
parseInt
(
$
(
".main-layout"
).
attr
(
"limit"
));
var
times
=
$
(
".main-layout"
).
attr
(
"times"
)
?
$
(
".main-layout"
).
attr
(
"times"
)
:
0
;
var
page
=
Math
.
ceil
(
parseInt
(
ajaxPage
)
/
(
total_times
+
1
));
var
totalPage
=
Math
.
ceil
(
total
/
(
limit
*
(
total_times
+
1
)));
if
(
$
(
window
).
scrollTop
()
>=
$
(
document
).
height
()
-
$
(
window
).
height
()
-
50
)
{
if
(
total
>
limit
&&
times
<
total_times
&&
page
<=
totalPage
)
{
$
.
ajax
({
type
:
"get"
,
url
:
url
+
"/page/"
+
(
parseInt
(
ajaxPage
)
+
1
),
success
:
function
(
data
)
{
var
news_page
=
$
(
data
);
if
(
$
(
".main-layout"
).
attr
(
"page"
)
!=
news_page
.
attr
(
"page"
)
&&
news_page
.
html
()
!=
""
)
{
$
(
".main-layout"
).
append
(
news_page
.
html
());
$
(
".main-layout"
).
attr
({
"total"
:
news_page
.
attr
(
"total"
),
"page"
:
news_page
.
attr
(
"page"
),
"times"
:
++
times
});
// console.log(news_page.attr("page"));
// console.log("times:" + times);
}
page
=
Math
.
ceil
(
parseInt
(
news_page
.
attr
(
"page"
))
/
(
total_times
+
1
));
//实现页码
// console.log("page:" + page);
// console.log("totalPage:" + totalPage);
if
(
times
==
total_times
||
news_page
.
html
()
==
""
||
page
==
totalPage
)
{
$
(
".main-layout"
).
append
(
getPagination
(
page
,
totalPage
));
}
}
});
}
else
if
(
page
==
totalPage
)
{
$
(
".main-layout"
).
append
(
getPagination
(
page
,
totalPage
));
}
return
false
;
}
});
};
});
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment