Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #630046

    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

    #631158

    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

    #631231

    Hello Ismael

    When I add this code to functions.php then my website is not working anymore.

    Looking forward for your reply.

    #631790

    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

    #631917

    Hey!

    My bad. The script wrapper is missing. We edited the code above. Please try it again.

    Regards,
    Ismael

    #631941

    Thanks Ismael! It’s working fine now.

    best regards,

    Alain

    #632462

    Hi Alain,

    Great, glad we could help :-)

    Regards,
    Rikard

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.