S
S
Shura01022021-12-21 14:02:04
JavaScript
Shura0102, 2021-12-21 14:02:04

Why are images not loading when switching pages?

Hello. When switching pages, pictures in the news are not loaded. I do so

<div class="bottom-nav ignore-select" id="bottom-nav">
      <div class="nav-load" id="nav-load">[next-link]Загрузить еще[/next-link]</div>
</div>


$(document).ready(function(){
    
    var loadLink = $('#nav-load'), loadStatus = 0;
    $(window).scroll (function () {
        if ($(this).scrollTop() + $(this).height() + 0 > loadLink.offset().top) {
            var urlNext = loadLink.find('a').attr('href');
            if (urlNext !== undefined && loadStatus == 0) {
                loadStatus = 1;
                $.ajax({
                    url: urlNext,
                    beforeSend: function() {
                        ShowLoading();
                    },            
                    success: function(data) {
                        $('#bottom-nav').remove();
                        $('#dle-content').append($('#dle-content', data).html()).after($('#bottom-nav'));
                        window.history.pushState("", "", urlNext);
                        HideLoading();
                        loadStatus = 0, loadLink = $('#nav-load');
                    }
                });
            } else {
                loadLink.remove();
            };
        };
    });  
    
});

but pictures of news in subsequent pages are not loaded. How can this be fixed?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question