Search code examples
javascriptjqueryinternet-explorer-11

On scroll load more data from database not working in IE 11


I trie to load more data on scroll to the bottom. All works fine in Edge,Chrome,Firefox but not in IE 11. Nothing happens there

Here's my Code:

$(window).scroll(function() {
    if ($(document).height() <= $(this).scrollTop() + $(this).height()) {
        if (timer) {
            window.clearTimeout(timer);
        }
        timer = window.setTimeout(function() {
            // Magic goes here
        }, 400);
    }
});

Meta Tag is set to

<meta http-equiv="X-UA-Compatible" content="IE=edge">

Many thx

EDIT

If i open the debug mode on IE , everything works fine. No errors


Solution

  • Just tested your code example on IE11 and works perfectly fine. Here is the test code i ran in the browser:

    var timer;
    
    $(window).scroll(function(){        
        if ($(document).height() <= $(this).scrollTop() + $(this).height()) {
            if(timer) {
                window.clearTimeout(timer);
            }
            timer = window.setTimeout(function() {
                alert('bottom of page');
             });
         }
    });
    

    Are there any errors thrown in your console on IE11? Sharing more of the code in question would help, as there is no inherent reason for the example you have given to not work on IE11.