0

这是html

<div id="cart_table" style="width:800px; position:absolute;">
    <h3>My Cart</h3>
    Please check your shipping data and press "Place Order" to complete this order
</div>

和 javascript

var cartTableTop = parseInt($('#cart_table').css('top'));
$(window).scroll(function() {
    $('#remove').html(cartTableTop) // just to debug
    $('#cart_table').css("top", (cartTableTop) + "px");
    $('#remove').html($('#remove').html()+' '+$('#cart_table').css('top'))// just to debug
});

cartTableTop== $('#cart_table').css('top') 但 #cart_table滚动后会向下跳。我该如何解决?

4

1 回答 1

0

我已经从您的代码中创建了一个 jsfiddle,但没有看到任何跳跃:http: //jsfiddle.net/qZJdB/1/。所以,问题可能出在代码的其他地方。

另外,我不明白调试位......#remove没有被渲染。

于 2012-09-27T17:10:22.363 回答