jQuery分页和放置动画的问题。?

时间:2011-08-15 08:54:24

标签: javascript jquery

问题1:为什么not change pagination after click(分页改变但没有)?
我的意思是在我的例子中(点击后这不会改变):enter image description here
示例: 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;
    });

尊重

2 个答案:

答案 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>&nbsp;
    <a href="http://www.binboy.gigfa.com/admin/hotel/show/3">2</a>&nbsp;
    <a href="http://www.binboy.gigfa.com/admin/hotel/show/6">3</a>&nbsp;
    <a href="http://www.binboy.gigfa.com/admin/hotel/show/3">&gt;</a>
     &nbsp;&nbsp;
    <a href="http://www.binboy.gigfa.com/admin/hotel/show/9">Last > </a>  
 </div>

并确保CSS中包含以下行:

div.pagination a.selected {
    font-weight: bolder;
}

好运!