Last active
December 28, 2015 04:38
-
-
Save alanerzhao/7443402 to your computer and use it in GitHub Desktop.
sad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//load more | |
(function () { | |
var loadObj = $(".loading-more"), | |
tabModCont = $(".tab-mod-content ul"), | |
tmpl ='', | |
lastBtnPos, | |
i = 1; | |
loadObj.click(function () { | |
i++; | |
lastBtnPos = loadObj.offset().top + $(document.body).scrollTop(); | |
$.ajax({ | |
url:"index.php?m=content&c=index&a=ajax_360_lists&catid=697&page="+i+"&pagesize=10", | |
type:"get", | |
dataType:"json", | |
success:function (data) { | |
var dataArr = data.msg; | |
if(data.code == 1) { | |
return false; | |
} | |
$.each(dataArr,function(idx,obj){ | |
tmpl+='<li><div class="mod-content"><div class="mod-content-ft"><a href="'+obj.url+'?from=3602" class="test-write">评测</a></div> <div class="mod-content-hd"><a href="'+obj.game_url+'?from=3602"><img src="'+obj.icon+'" width="64" height="64" alt="" /></a></div> <div class="mod-content-bd"> <h3><a href="'+obj.game_url+'?from=3602">'+obj.title+'</a></h3> <p class="score"><span class="score-number">9.8</span>分</p> <p class="describle">'+obj.brief+'</p></div></div></li>'; | |
}) | |
$(tmpl).hide().appendTo(tabModCont).fadeIn(1000); | |
if(dataArr.length <=7) { | |
loadObj.unbind().find("a").text("已经加载完成!!"); | |
return false; | |
} | |
}, | |
error: function () { | |
} | |
}) | |
console.log(lastBtnPos); | |
console.log($(document.body).scrollTop()); | |
$(document.body).stop().animate({"scrollTop":lastBtnPos},1200); | |
}) | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment