Home Forums WoodMart support forum On Accordion tab close, move user back up the screen.

On Accordion tab close, move user back up the screen.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #381823

    Jackmagic
    Participant

    Hi there,

    When a user opens an Accordion Tab and scrolls down to read the information in that, then opens a Tab below the one open, they stay at that current place on the page and have to scroll back up to start reading again.

    Is it possible to automatically take the user back up to where that new Tab’s opens on the page, rather than make the user scroll back up?

    I have provided a video example here: https://www.loom.com/share/4844c5adc48e4ea9a47327a9972be9e6

    #381935

    Hello,

    Please provide the URL of the page to check it myself and help you out accordingly.

    Best Regards

    #382053

    Jackmagic
    Participant

    I have included the page in a private link below.

    I simply need the screen to scroll up with user as the accordion closes, rather than leaving them first down the screen.

    Thanks in advance.

    #382072

    Jackmagic
    Participant

    I found this support request from another plugin but thought it could help: https://wordpress.org/support/topic/accordion-scroll-to-top-of-active-open-accordion-on-click/

    I tried to use this code but it didn’t help:

    jQuery( document ).ready( function( $ ) {
    $( '.wd-accordion-title' ).click( function( ) {
    var pane = $(this);
    setTimeout(function(){
     var $panel = pane.closest('.wd-accordion-item');
        $('html,body').animate({
            scrollTop: $panel.offset().top
        }, 500); 
    }, 300 );
    });
    });
    #382198

    Hello,

    Please try the below custom JS code:

    (function($) {
    	$('.wd-accordion-title').off('click').on('click', function() {
    		setTimeout(function() {
    					$('html, body').animate({
    						scrollTop: $(this).offset().top - $(this).outerHeight()
    					}, 500);
    				}, 300);
    	});
    	})(jQuery);

    Best Regards.

    • This reply was modified 1 year, 10 months ago by Rayan Dunn.

Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)