When loading a page from the database, 5 elements are selected. When the user scrolls down, another 5 messages are loaded, etc.
To prevent duplicate messages when sorting by 'new', I put page load time in hidden input, which will be used in JavaScript:
<input id="loadTime" type="hidden" value="<?php echo time(); ?>">
Then, when you select more messages while scrolling, I only select new ones until this time to prevent duplicate messages.
WHERE s.date < :loadTime
However, my problem is sorting by hot or top because it does not use the same logic.
Is it possible to detect that two elements on a page have the same identifier? Because when a duplicate post is added to the page, it will have the same identifier as on it. In some form, $(window).scroll()is there a function that removes a duplicate ID after that, so that the user does not see duplicate messages?
source
share