1
下面的代碼在Firefox 19.0中按照預期工作。該腳本從數據庫加載隨機文章。無限滾動:Chrome中的雙重內容+不能在IE中工作
它在Internet Explorer中反覆加載相同的內容,並在Chrome中加載兩次以上的不同內容。
<script type="text/javascript">
$(window).scroll(function()
{
if($(window).scrollTop() == $(document).height() - $(window).height())
{
$('div#loadmoreajaxloader').show();
$.ajax({
url: "loadmore.php",
success: function(html)
{
if(html)
{
$("#wrapper").append(html);
$('div#loadmoreajaxloader').hide();
}else
{
$('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
}
}
});
}
});
</script>
這裏是loadmore.php
<?php
include('db.php');
$stmt = $db->prepare("SELECT * FROM db ORDER BY RAND() DESC LIMIT 9");
if($stmt->execute()){
while ($row = $stmt->fetch()) {
echo'
content here
';}}
?>
我只是注意到它可以在Firefox和Chrome中完美工作。這是一個IE問題。我試過你的修復,但IE瀏覽器仍然顯示相同的內容。實際上,當我在IE中重新加載頁面時,我應該看到不同的內容,但我看到了相同的內容。奇怪的。我認爲某種緩存問題。 – 2013-03-02 21:32:31
我不知道。也許如果你在jsfiddle.net上發佈你的代碼的例子,我可以幫助你更多... – NotGaeL 2013-03-02 22:30:33