我的插件twbs-pagination有问题。未捕获的错误:“起始页”选项不正确。
function paginationInit(pages) {
var current = 1;
paginationItem.twbsPagination('destroy');
paginationItem.twbsPagination({
totalPages: pages,
visiblePages: 5,
next: 'Next',
prev: 'Prev',
startPage: current,
hideOnlyOnePage: true,
initiateStartPageClick: false,
onPageClick: function (event, page) {
var target = $('#label-search');
index = page - 1;
current = page;
$('.background-target').css({
'height': heightResult
});
target.trigger('submit');
}
})
}
我尝试console.log所有变量,并且一切正常。有什么想法是什么问题吗?
答案 0 :(得分:-1)
startPage的值必须为整数值
尝试一下:
function paginationInit(pages) {
var current = 1;
paginationItem.twbsPagination('destroy');
paginationItem.twbsPagination({
totalPages: pages,
visiblePages: 5,
next: 'Next',
prev: 'Prev',
startPage: parseInt(current),
hideOnlyOnePage: true,
initiateStartPageClick: false,
onPageClick: function (event, page) {
var target = $('#label-search');
index = page - 1;
current = page;
$('.background-target').css({
'height': heightResult
});
target.trigger('submit');
}
})
}