问题1:为什么not change pagination after click
(分页改变但没有)?
我的意思是在我的例子中(点击后这不会改变):
示例: My code
问题2:我想为分页表添加animate like this
但更强大:http://jsfiddle.net/wY3Us/3/
Js代码:
$('#pagination a').live('click', function(e) {
e.preventDefault();
$.get( $(this).attr('href'), function(html) {
$('table#paginate').replaceWith( $(html).find('table#paginate') );
});
return false;
});
尊重
答案 0 :(得分:0)
我认为你提供错误的IF,你的分页链接在#pagination div,trip>
$('#pagination').replaceWith( $(html).find('#pagination') );
答案 1 :(得分:0)
将您的javascript更改为:
$('#pagination a').live('click', function(e) {
e.preventDefault();
$.get( $(this).attr('href'), function(html) {
$('table#paginate').replaceWith( $(html).find('table#paginate') );
});
return false;
$('.pagination a').removeClass('selected');
$(this).addClass('selected');
});
你的HTML应该是这样的:
<div class="pagination">
<a class="selected" href="http://www.binboy.gigfa.com/admin/hotel/show/1">1</a>
<a href="http://www.binboy.gigfa.com/admin/hotel/show/3">2</a>
<a href="http://www.binboy.gigfa.com/admin/hotel/show/6">3</a>
<a href="http://www.binboy.gigfa.com/admin/hotel/show/3">></a>
<a href="http://www.binboy.gigfa.com/admin/hotel/show/9">Last > </a>
</div>
并确保CSS中包含以下行:
div.pagination a.selected {
font-weight: bolder;
}