Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1020478

    Hi,

    Enfold theme is great! I was wondering if I could add an auto-scroll down feature to the Tab Section when you click on a tab so it moves up so you can see what is below. My client is complaining that the user won’t know to scroll down there.

    • This topic was modified 6 years, 2 months ago by msutherin.
    #1021120

    Hey msutherin,
    Sorry for the late reply, but thanks for the link to the site.
    I have two working scripts for you to try out by adding to the end of your functions.php
    Please don’t install both at the same time,they each work a little different and I wanted you to choose the best one for your project.
    They will both scroll down on click of your tab section. This first one will scroll down based on the vertical scroll bar position, so you can adjust the “1100”, which in my tests puts the tab link images just up out of view. This may change a little based on the screen width of the visitor, but it should not be too much difference.

    function scroll_down_script_1(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
    $('a.av-section-tab-title').click(function () {
      $('html, body').animate({
          scrollTop: (1100)
      }, 'slow');
    });
     });
      })(jQuery);
    </script>
      <?php
      }
      add_action('wp_footer', 'scroll_down_script_1');

    This second one will scroll down to a element, so I choose the diamond shape of the bottom of the tab section, which in my tests puts the tab link images just up out of view. This should not change and be consent for everyone. The number in this code is how fast it will scroll down, 500 is half of a second.

    function scroll_down_script_2(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
    $('a.av-section-tab-title').click(function () {
        $('html, body').animate({
            scrollTop: $('.av-tab-arrow-container').offset().top
        }, 500);
    });
    });
      })(jQuery);
    </script>
      <?php
      }
      add_action('wp_footer', 'scroll_down_script_2');

    So try them out and let us know which one you end up using.

    Best regards,
    Mike

    #1030007

    Hi,

    The first one works best by changing the vertical position. The second one auto scrolls down whether I click something or not. So I will go with the first version.

    Thanks so much!!!

    #1030022

    Correction. Both auto scroll down when you load the page. So if you go HOME it just automatically goes down to that area without actually clicking anything.

    I deleted the code. Any ideas why that happened?

    #1030207

    Hi,
    That is odd, both are triggered by a “click” on a “av-section-tab-title” link.
    Perhaps there was some conflict, please include admin login in the Private Content area so we can be of more assistance.

    Best regards,
    Mike

    #1041810

    Hi Mike,

    Would admin login give you access to the functions.php? Do you just need to see what’s happening? I could take a video and post to youtube or something. I’m trying this on a local MAMP server before I try it on the online version.

    #1041813

    Just to add, both technically work. The problem is the page automatically scrolls down to the tab section without clicking on anything. I’ve reset cache too. If you scroll back up and then click the tab, it scrolls down as it should with the new script. Just need to stop it from doing it automatically on the page load.

    #1041910

    Hi,
    The admin login would allow us to see if there are any conflicts, but we would not know what exactly to look for at first so creating a video of your localhost would not be a lot of help.
    When I tested this on my localhost I didn’t have this error.
    please check your webhost to see if you have the one click staging site option, this is a option in most cPanels to create a staging clone of your site so we can test on it and you site will stay up and running. You can always ask your webhost to help you with setting this up if you want.

    Here are some screenshots of what it would look like:
    staging-1
    staging-2

    Best regards,
    Mike

    #1143282

    Hi,
    thanks Mike for your scripts, the 2nd works good for me.
    I added it only for mobile :

    // scroll to tabs
    function scroll_down_script_2(){
    ?>
    <script>
    	if(window.outerWidth <= 990) {
    		(function($){
    		$(document).ready(function(){
    		$('a.av-section-tab-title').click(function () {
    		$('html, body').animate({
    		scrollTop: $('.av-tab-section-container').offset().top
    		}, 500);
    		});
    		});
    		})(jQuery);
    	}
    </script>
    <?php
    }
    add_action('wp_footer', 'scroll_down_script_2');
    #1143327

    Hi MK_01,

    Glad you got it working for you with Mike’s help! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1343997

    Hi, I found this script, but I’m facing the same issue: auto-scroll on page load (without any click).
    I’ve also tried deactivating all plugins and other scripts. Same odd result.
    I’ve also tried .on(‘click’) instead of .click()…same same

    This is what I get in the console:
    The service worker navigation preload request was cancelled before ‘preloadResponse’ settled. If you intend to use ‘preloadResponse’, use waitUntil() or respondWith() to wait for the promise to settle.

    Any thoughts? Thanks!

    #1344202

    Hi,
    @freddyB please open a new thread with a link to a test page with an admin login explaining thoroughly what you are trying to achieve, this thread is from 2018. Please link to your new thread here so it will be easier to find, thanks.

    Best regards,
    Mike

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