我使用jQuery的无限滚动代码不适用于ie [英] My infinite scrolling code using jQuery doesn't work on ie
问题描述
我构建了一个简单的ajax和jQuery无限滚动。它在Chrome上运行良好,但它不在Internet Explorer上...
IE的问题在于它不止一次返回相同的结果,就像它一样不止一次地循环遍历ajax调用。每次我滚动越来越多,重复的内容被附加到ID div的末尾。
这是代码...
I built a simple ajax and jQuery infinite scrolling. It works great on Chrome but it doesn''t on Internet Explorer ...
The problem with IE is that it returns the same results more than once, like it is looping through the ajax call more than once. And each time I scroll further more and more duplicate content is appended to the end of the ID div.
Here is the code ...
$(document).ready(function(e){
$(document).scroll(function(){
if($(window).scrollTop() + $(window).height() == $(document).height()){
var pictureCount = $(".Picture-1A").length;
alert(pictureCount);
$.get(''ajax/more-pictures.php'', {off_set:pictureCount}, function(data){
$("#Picture-1A").append(data);
});
}
});
});
我已经在互联网上搜索了解决方案,我想到的就是Internet Explorer缓存Ajax。他们建议我添加:
I have searched the internet for solution and all I have come up with is that Internet Explorer cache Ajax. And they have recommended me to add:
$.ajaxSetup({cache:false});
但它不起作用。请尝试使用一组结果的代码并在IE上进行测试,看看你能理解的更多。
感谢您的帮助
Farris
But it doesn''t work. Please try the code with a set of results and test it on IE and see what you get to understand more.
Thanks for your help guys
Farris
推荐答案
(document).ready(function(e){
(document).ready(function(e){
(document).scroll(function( ){
if(
(document).scroll(function(){ if(
(window).scrollTop()+
(window).scrollTop() +
这篇关于我使用jQuery的无限滚动代码不适用于ie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!