[英]Problem with jQuery pagination and putting an animate.?
Question 1: Why not change pagination after click
(pagination page change but it no)?问题1:为什么
not change pagination after click
(分页改变但没有)?
I mean is here in my example (this not change after click):我的意思是在我的示例中(单击后不会更改):
EXAMPLE: My code示例:我的代码
Question 2: I want putting an animate like this
for pagination table but stronger: http://jsfiddle.net/wY3Us/3/问题2:我想为分页表添加
animate like this
,但更强大: http://jsfiddle.net/wY3Us/3/
Js code: js代码:
$('#pagination a').live('click', function(e) {
e.preventDefault();
$.get( $(this).attr('href'), function(html) {
$('table#paginate').replaceWith( $(html).find('table#paginate') );
});
return false;
});
With respect尊重地
I think you are giving wrong ID, your pagination links are on #pagination div, try我认为您提供了错误的 ID,您的分页链接在#pagination div 上,请尝试
$('#pagination').replaceWith( $(html).find('#pagination') );
Change your javascript to this:将您的 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');
});
And your html should look like this:您的 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>
And make sure you have the following lines in your CSS:并确保您的 CSS 中有以下行:
div.pagination a.selected {
font-weight: bolder;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.