@dcooney.. Yes it helped me a lot. You are awesome.. If you don’t mind, I’d like to ask you for one more solution..
I’ve this tab to load different categories of post. I tried to applied ALM but here too I’m not able to get the auto scroll working.. Yes, the first page loading occurs but subsequent auto scrolling doesn’t work.. I like using tabs because it’s way faster.. here is the code I use
<button class=”tablinks” onclick=”openCity(event, ‘post1’)” id=”defaultOpen”>post1</button>
<button class=”tablinks” onclick=”openCity(event, ‘post2’)”>post2</button>
<button class=”tablinks” onclick=”openCity(event, ‘post3’)”>post3</button>
</div>
<div id=”post1″ class=”tabcontent”>
<?php echo do_shortcode(‘[ajax_load_more container_type=”div” post_type=”post” category=”post1″]’); ?>
</div>
<div id=”post2″ class=”tabcontent”>
<?php echo do_shortcode(‘[ajax_load_more container_type=”div” post_type=”post” category=”post2″]’); ?>
</div>
<div id=”post3″ class=”tabcontent”>
<?php echo do_shortcode(‘[ajax_load_more container_type=”div” post_type=”post” category=”post3″]’); ?>
</div>
<script>
function openCity(evt, cityName) {
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName(“tabcontent”);
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = “none”;
}
tablinks = document.getElementsByClassName(“tablinks”);
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(” active”, “”);
}
document.getElementById(cityName).style.display = “block”;
evt.currentTarget.className += ” active”;
}
// Get the element with id=”defaultOpen” and click on it
document.getElementById(“defaultOpen”).click();
</script>
Just that load more or auto scroll is not working otherwise first page loads normally..
Thank you very much for help..I will review..
-
This reply was modified 7 years, 7 months ago by jbboro3.