我正在查看firetube示例,并希望在按下按钮后更改限制,例如,按下更多按钮并在firetube.js文件中调用fucntion。这需要增加查询限制,以便显示更多项目。我该怎么做?以下是我的代码:
var commentLimit = 10;
//Create a query for only the last 10 comments
var last10Comments = commentsRef.limit(commentLimit);
//Render Comments
last10Comments.on('child_added', function (snapshot) {
var comment = snapshot.val();
var newDiv = $("<div/>").addClass("comment").attr("id",snapshot.name()).appendTo("#comments");
FB.api("/" + comment.userid, function(userdata) {
comment.name = userdata.name;
newDiv.html(Mustache.to_html($('#template').html(), comment));
});
});
负载更多功能:
function loadMoreClicked() {
commentLimit = commentLimit + 10;
commentsRef = new Firebase(firebaseURL);
last10Comments = commentsRef.limit(commentLimit);
}