Hi, i created a one pager with this theme. the 5th block element on the page is a News section. This News section loads 3 News items and has pagination to go to the next news items. When I click pagination , then the next news items are loaded, but the page jumps to the top. I want to stay on that News section and not need to scroll down again. How can I change that? The url is http://bit.ly/23EB0w9
Hey AlainL,
Thank you for using Enfold.
Please try adding this at the very end of your themes / child themes functions.php file:
function add_custom_script(){
?>
<script type="text/javascript">
(function($){
function b() {
$('.pagination .inactive').click(function(e) {
e.preventDefault();
var news = $('#news'),
link = $(this).attr('href'),
anchor = $(news).attr('id');
if(!news.length) return;
var link = link + '#' + anchor;
window.location.href = link;
});
}
b();
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
Best regards,
Ismael
Hello Ismael
When I add this code to functions.php then my website is not working anymore.
Looking forward for your reply.
Hi,
Please send us a temporary admin login so that we can have a closer look. You can post the details in the Private Content section of your reply.
Regards,
Rikard
Hey!
My bad. The script wrapper is missing. We edited the code above. Please try it again.
Regards,
Ismael
Thanks Ismael! It’s working fine now.
best regards,
Alain