Tagged: auto scroll, enfold, yigit
-
AuthorPosts
-
June 23, 2015 at 12:47 pm #463312
Hi All,
The more I am working with Enfold, feels like exploring more and more options within this wonderful theme.
Just wanted to check if it is possible to add an automatic scroll functionality to the home page which scrolls after 5 seconds to the next section. Which in this case is /#av_section_2.June 23, 2015 at 3:25 pm #463455Hi Vikrant!
Please add following code to Functions.php file of your theme in Appearance > Editor
function add_custom_link(){ ?> <script> jQuery(window).load(function () { window.setTimeout(function() { window.location.href = 'http://yourdomain.com/#av_section_2'; }, 5000); }); </script> <?php } add_action('wp_footer', 'add_custom_link');
Cheers!
YigitJune 23, 2015 at 3:56 pm #463471Hi Yigit,
The code does the job but it removes the animation that occurs when you press the scroll arrow on the home page. Let me know if we can do something about it.
Thanks
June 24, 2015 at 11:02 am #463900Hey!
Do you mind if we take a look at the website? Please make sure that you have the latest version of the theme.
Cheers!
IsmaelJune 26, 2015 at 3:33 pm #465021June 26, 2015 at 3:34 pm #465022Please check the given website
June 30, 2015 at 9:47 am #466242Hey!
it seems to work normally when I press your scroll down arrow on the homepage. About which arrow are you talking about exactly? and what are the steps to see the issue? you can use screenshots (imgur, dropbox) to make things clear.
Regards,
AndySeptember 16, 2015 at 2:41 pm #504135Hi Guys :) i have the same problem as the other guy.
i have added the code given by Yigit to my functions file.
all is working fine except of the smooth scrolling animation.if i click the next section button the site starts to scroll down super smooth if i just stay on the site to wait until the function does the auto scroll action it does jump to the next section but unfortunately without the great smooth effect.
is there a way to get that fixed or added to the code Yigit has provided ?
September 17, 2015 at 1:26 pm #504740September 17, 2015 at 2:23 pm #504795Hi Andy,
if you click the arrow at the bottom of the slider image the website scrolls down to the next section using the smooth scroll effect.
if you just stay on the site for 5 seconds the code Yigit provided gets in action. The thing is that it just jumps to the section it doesn’t use the smooth scroll effect.
i hope you understand what i mean.
September 22, 2015 at 3:23 pm #507113Hey!
Try this out.
function add_custom_link(){ ?> <script> jQuery(window).load(function () { jQuery('html, body').animate({ scrollTop: jQuery("#av_section_2").offset().top }, 1000); }); </script> <?php } add_action('wp_footer', 'add_custom_link');
You might want to add a check for the homepage there or just add the script to a codeblock element in the homepage content.
Best regards,
Elliott- This reply was modified 9 years, 1 month ago by Elliott.
-
AuthorPosts
- You must be logged in to reply to this topic.