Skip to content Skip to sidebar Skip to footer

Photoswipe Same Source Code But Output Not Working

I have this piece of code, which refreshes the content of an ul. It works on the first load, where the content of ul is directly loaded, but i am making new content every 10 secon

Solution 1:

I would use jQuery ready.

Something like

<scripttype="text/javascript">
$(document).ready(function(){
    setInterval(function() {
        $("#vbar").load(location.href+" #vbar>*","");
    }, 10000);
});
</script>

BUT, a better way is explained by @Cletus in his answer.

There is a carousel in the example that you linked in the comment section, the issue right now is that while in the carousel, the setTimeout doesn't update the carousel

The solutions:

  • Create an array to store ALL the images that are being updated.
  • Update the imgs in the carousel, calling the carousel in the setTimeout

In both, you need to see if the code in the carousel is blocking the code of the timeout. Check with chrome dev tools, or even an alert('test'); should do the job.

Post a Comment for "Photoswipe Same Source Code But Output Not Working"