Community Forums › Forums › Archived Forums › Design Tips and Tricks › Smooth Scroll on Agency Theme
Tagged: Agency Theme, Smooth Scroll
- This topic has 5 replies, 3 voices, and was last updated 9 years, 1 month ago by
Darren.
-
AuthorPosts
-
December 29, 2013 at 8:50 pm #81961
ben_indt
MemberClicking on the 'Our Work' button on the home page of the Agency Template results in a smooth scroll to the anchor half way down the page.
However, when I create a button on other pages which I would also like to smooth scroll, it just jumps instantly down the page. For example, the 'itinerary' button on this page: http://indulgencetours.com/nz/self-drive/christchurch-to-queenstown-with-milford-8-days/#itinerary
Could you please advise how to get smooth scrolling working as per the home page?
I requested assistance for this from Studiopress but was referred to this forum. They mentioned that there is relevant code in the front-page.php file, and I'm assuming its this code that they are referring to...
function agency_enqueue_scripts() { if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-bottom' ) ) { wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '1.4.5-beta', true ); wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '1.2.8b', true ); wp_enqueue_script( 'home', get_stylesheet_directory_uri() . '/js/home.js', array( 'localScroll' ), '', true ); } }
I tried copying and pasting that into my custom page template, to no avail.
- Is it correct that this is the code I should copy/paste?
- Where exactly in the custom page template should it be pasted?
- The Studiopress support person also mentioned that there is a custom file specifically for the homepage in the js folder of the theme. Is there anything I need to do with that?
Many thanks!
Ben
http://indulgencetours.com/nzDecember 30, 2013 at 2:12 am #81988Sridhar Katakam
ParticipantJanuary 3, 2014 at 7:01 pm #83027ben_indt
MemberMany thanks for the suggestion, but I'd much rather do this without a plugin.
Since smooth scroll functionality already exists in the theme, I'd like to find out how to get the code in the right places so that it works on the pages I want it to.
Any thoughts?
January 4, 2014 at 5:13 am #83086Sridhar Katakam
ParticipantTry this.
Place
add_action( 'wp_enqueue_scripts', 'ben_enqueue_scripts' ); /** * Enqueue Scripts */ function ben_enqueue_scripts() { wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '1.4.5-beta', true ); wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '1.2.8b', true ); wp_enqueue_script( 'home', get_stylesheet_directory_uri() . '/js/home.js', array( 'localScroll' ), '', true ); }
in your custom page template file.
Also I just published http://sridharkatakam.com/smooth-scrolling-page-links-genesis-theme/. You might want to see that.
January 4, 2014 at 6:49 pm #83287ben_indt
MemberWow, what an amazing, top-quality response! I never expected a full tutorial to come of this. Many thanks Sridhar, that worked perfectly.
Cheers,
Ben
February 5, 2014 at 6:03 am #88740Darren
MemberHey Sridhar - will this work on parallax pro?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.