...
|
...
|
@@ -159,13 +159,6 @@ define('mobile', function(require, exports) { |
|
|
$('.scene-content').find('.layout-item').each(function() {
|
|
|
$(this).imgZoom();
|
|
|
});
|
|
|
//获取手机屏幕高宽
|
|
|
/*var width = $(window).width();
|
|
|
//
|
|
|
$("img.lazy").each(function() {
|
|
|
$(this).attr("data-original", $(this).attr("data-original") + "?imageView/2/w/" + width);
|
|
|
});
|
|
|
$("img.lazy").lazyload();*/
|
|
|
};
|
|
|
|
|
|
exports.detail = function() {
|
...
|
...
|
@@ -175,7 +168,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', {
|
...
|
...
|
@@ -188,11 +181,9 @@ define('mobile', function(require, exports) { |
|
|
autoplayDisableOnInteraction: false
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if ($('.slide-navigator .dib').find('a').size() <= 1) {
|
|
|
$('.slide-navigator').hide();
|
|
|
}
|
|
|
|
|
|
//截字
|
|
|
$('.related-post').find('.content').each(function() {
|
|
|
$(this)[0].mlellipsis(2);
|
...
|
...
|
@@ -244,11 +235,75 @@ define('mobile', function(require, exports) { |
|
|
|
|
|
exports.news = function() {
|
|
|
$('select').on('change', function() {
|
|
|
/* var nowIndex = $('option').not(function() {
|
|
|
return !this.selected
|
|
|
}).index();
|
|
|
$('.news-main').removeClass('current').eq(nowIndex).addClass('current');*/
|
|
|
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 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 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;
|
|
|
}
|
|
|
$(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 |
|
|
}); |
...
|
...
|
|