Auto-Scroll isn't correct
April 2014 WordPress Theme
- GK User
- Sun May 11, 2014 7:51 pm
Hi,
I have some problems with my site..
When i click on the menu it scrolls down to a section, but it is not stopping at the top of the section..
Instead it scrolls a fed pixels too far.
Is there some way to fix it?
Domain: http://www.niklasw.dk
Niklas
I have some problems with my site..
When i click on the menu it scrolls down to a section, but it is not stopping at the top of the section..
Instead it scrolls a fed pixels too far.
Is there some way to fix it?
Domain: http://www.niklasw.dk
Niklas
-
- Fresh Boarder
- GK User
- Sun May 11, 2014 9:25 pm
Please edit file:
/wp-content/themes/John/js/gk.scripts.js
find this section:
And modify line:
Adding a offset:
Modify the value to suit your needs.
/wp-content/themes/John/js/gk.scripts.js
find this section:
- Code: Select all
// smooth anchor scrolling
jQuery('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash,
target = jQuery(target);
if(target.parent() !== jQuery('#gk-style-area')) {
jQuery('html, body').stop().animate({
'scrollTop': target.offset().top
}, 1000, 'swing', function () {
window.location.hash = target.selector;
});
}
});
And modify line:
- Code: Select all
'scrollTop': target.offset().top
Adding a offset:
- Code: Select all
'scrollTop': target.offset().top - 20
Modify the value to suit your needs.
-
- Moderator
- GK User
- Mon May 12, 2014 8:18 pm
Great thanks.. I will try that!
-
- Fresh Boarder
- GK User
- Tue May 13, 2014 12:32 pm
It worked perfectly.. But the selected menu point doesn´t change at that point??
-
- Fresh Boarder
- GK User
- Tue May 13, 2014 4:32 pm
I don't see suggested change in your gk.scripts.js file
-
- Moderator
- GK User
- Mon Jan 12, 2015 11:20 am
This is what I needed! Thanks!
-
- Expert Boarder
- GK User
- Tue Jan 13, 2015 6:07 pm
No problem . It's always nice to see users searching through available threads.
-
- Moderator
7 posts
• Page 1 of 1