相當簡單的概念。我有一個分頁的數據源,它將內容以15塊的形式提供給砌體牆。我想在那裏粘貼一個「加載更多」按鈕。使用XSLT加載更多內容?
我是否需要加載整個DS並消除分頁,然後用jQ掩蓋它?聽起來像它可以得到滯後?
如何連接此功能?如果需要請僅輸入XML輸出?我試着簡單地從砌體文檔中獲取現有的Append按鈕,但是我的代碼使它作爲頁面「NaN」的鏈接工作......我沒有真正混合過XSL和jQuery。不知道從哪裏開始..下面是我的按鈕代碼。
<a href="{$root}/?page={/homepage-aritcles/pagination/@current-page + 1}"> <button id="append-button">++++ LOAD MORE POSTS ++++</button> </a>
這裏的相對JS:
function getItemElement() {
var elem = document.createElement('div');
elem.className = 'item ' ;
return elem;
}
$(function(){
var $container = $('.post.content'),
$boxes = $container.find('.item'),
firstTime = true;
$(window).smartresize(function(){
var containerWidth = $container.width(),
colWidth = Math.floor(containerWidth/3),
applyStyleFnName = firstTime ? 'css' : 'animate';
$boxes.each(function(){
var $this = $(this),
cols = $this.data('cols'),
boxWidth = Math.floor(colWidth * cols);
$this[ 'css' ]({ width: boxWidth }, { queue: false });
});
$('#append-button').on('click', function() {
var elems = [ getItemElement() ];
$container.append(elems).masonry('appended', elems);
});
不知道環境是什麼。這是客戶端XSLT嗎? –