I wanted to add some part of my main page with infinite scroll and it is working. But also I want to add this part of my page with an link. Normally it is work if my site name is like (https://example.com/index) but I don't want to redirect it. I want to make it work in (https://example.com) format. I think the problem is about jQuery selector.
function setupPage() {
const list = $(".list");
if (count === 0) {
list.append(
` <div> Hello</div>`);
count++;
}
setTimeout("window.location = 'index#contact'", 100);
}
<li><a href="javascript:void(0); " onclick="setupPage()">Contact</a></li>
<div class="list "> Content. </div>