jquery not working after endless scrolling

tayssirch
New Member
1 0 0

Hello, I have this codes placed in my footer, i use this one to create endless scroll https://ajaxinate.elkfox.io/

<script>  
  document.addEventListener("DOMContentLoaded", function() {

    var endlessScroll = new Ajaxinate({
      container: '.product-list',
      pagination: '.pagination'
    });
  });
</script>

also i have this custom Jquery script

   
var ret = "{{canonical_url}}";
var ret = ret.replace('https://bevegan.ae','');
var els = document.getElementsByName("return_to");
for (var i=0;i<els.length;i++) {
els[i].value = ret;
}
$('.add').click(function () {
    	$(this).prev().val(+$(this).prev().val() + 1);
});
$('.sub').click(function () {
		if ($(this).next().val() > 1) {
    	if ($(this).next().val() > 1) $(this).next().val(+$(this).next().val() - 1);
		}
});

 

the problem is on page code, my custom script is working fine, but then scrolling, and endless scroll retrieve new product, the code is not working anymore, i beleive i should add callback: for the endless scroll, to re-call the jquery ?

can you advice please

0 Likes