خرید بک لینک

Vote count: 0

I have a plugin that tells me if an element is visible in the viewport with $('#element').visible() (set to true when visible).

Now I want to create a function that I scroll down a page and load new content with ajax. I have this so far:

window.onscroll = function() {
    console.log($('#ele').visible());

    if ($('#ele').visible()) {
               //ajax call comes here
    }

};

As soon as I see the element my log shows true:

enter image description here

I don't have problems implementing the ajax-request now, but shouldn't I block this function to occur only once? How could I prevent that a new element that already has been loaded to load again (prevent using ajax again)?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 19 تير 1395 ساعت: 11:38

صفحه بندی