![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
Tagged: enfold, scroll, tab section
-
AuthorPosts
-
October 11, 2018 at 9:15 pm #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 5 years, 11 months ago by
msutherin.
October 14, 2018 at 12:07 am #1021120Hey 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,
MikeNovember 5, 2018 at 7:30 pm #1030007Hi,
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!!!
November 5, 2018 at 7:54 pm #1030022Correction. 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?
November 6, 2018 at 5:59 am #1030207Hi,
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,
MikeDecember 6, 2018 at 7:47 pm #1041810Hi 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.
December 6, 2018 at 7:52 pm #1041813Just 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.
December 7, 2018 at 5:29 am #1041910Hi,
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:
Best regards,
MikeSeptember 30, 2019 at 10:51 am #1143282Hi,
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');
September 30, 2019 at 11:53 am #1143327Hi MK_01,
Glad you got it working for you with Mike’s help! :)
If you need further assistance please let us know.
Best regards,
VictoriaMarch 10, 2022 at 1:27 pm #1343997Hi, 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 sameThis 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!
March 12, 2022 at 12:47 pm #1344202Hi,
@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 -
This topic was modified 5 years, 11 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.