我有一个 jquery Ajax 调用来更改 div 的内容,功能方面一切正常,但是,当 div 被新内容替换时,页面几乎不会晃动,并且视图位置也会发生一些变化。得到的内容下面给出了刷新,我的意思是我在 ajax 调用后得到的 html 响应。
<div class="booksFrame">
<a href="Magazine/magazinedetail/magazine_id/3"><img src="XXXXXX" alt="Pachakuthira" title="Pachakuthira" /></a>
</div>
<div class="booksFrame">
<a href="Magazine/magazinedetail/magazine_id/43"><img src="XXXXXX" alt="Toms Classics" title="Toms Classics" /></a>
</div>
<div class="booksFrame">
<a href="Magazine/magazinedetail/magazine_id/34"><img src="XXXXXX" alt="The Sunday Indian (English)" title="The Sunday Indian (English)" /></a>
</div>
<div class="booksFrame">
<a href="Magazine/magazinedetail/magazine_id/26"><img src="XXXXXX" alt="Travel Plus" title="Travel Plus" /></a>
</div>
<div class="rightArrow"><img src="XXXXXX" alt="next" title="next" id="next2" onclick="javascript:nextTopseller(this);" /></div>
<input type="hidden" value="6" id="page_number_topseller" />
我的ajax调用函数。
function latestArrivalNext(next)
{
$("#previous").css("display", "block");
if($('#page_number').val())
{
page = Number($('#page_number').val());
page = page+1;
/*alert(page);*/
$("#ajax_container").html('<img src="/public/images/loading.gif" />').fadeIn('fast');
}
else
page = 2;
$.ajax
({
type: "POST",
url: "index/scrollnewrelease",
data: "page="+page,
success: function(msg)
{
/*alert(msg);*/
if(msg!=0)
{ /*alert(msg);*/
$("#ajax_container").html(msg).fadeIn('slow');
$("#previous").css("display", "block");
}else
$(next).css("display", "none");
}
});
}