Slider button scrolls too far on desktop

Hey there,
your theme rocks! There is only a tiny issue I am competing with. When I hit the slider’s call to action button (means “Welcome”) on a desktop, laptop or tablet device it scrolls down just a bit too much. It works perfectly on mobile devices though. I tried using the block or id method, but it’s beyond my haxx0r skillz :wink:
Appreciate your help!
Oh, and here’s my site:

drkalmar.at

Best,
Peter

Dear Peter,

Thank you for getting in touch here.

Apologies for inconvenience.

In order to fix such kind of that issue, please try to do the following steps:

  1. Open the js/main.js in your code editor, then copy the whole content of it; then paste it into js/main.min.js. So it will be more readable

  2. In the js/main.min.js, find the following code block:

$('html,body').animate({
  scrollTop: target.offset().top - 70
}, 1000);
  1. Replace it with the following:
var distance = 70;

if ( matchMedia( 'only screen and (min-width: 992px) and (max-width: 1024px)' ).matches ) {
  distance =  340;
}

if ( matchMedia( 'only screen and (min-width: 1025px)' ).matches ) {
  distance =  170;
}

$('html,body').animate({
  scrollTop: target.offset().top - distance
}, 1000);
  1. You might want to minify this JS file here
  2. Save changes. Then update through FTP or cPanel

You would need to clear your browser’s cache before reloading your site. If you site is being cached by a cache plugin like W3 Total Cache, delete all cache as well.

This is just information - As you are editing the core theme’s file, you should take it at your own risk. The modifications you’ve made will be lost once the theme gets updated in the future. So you should do this adjustment again.

Regards,
Kharis

Kharis,

your theme used to rock…
now it rocks even more!1!!
Thanks for the

    superfast
support and best regards,
Peter

Dear Code-Wizards,
I guess I need your help again since the Sydney code has been changed significantly since the last update.
Now I’m not sure which code block to replace exactly. Maybe this?:

` if ( $target.length ) {
e.preventDefault();
$(‘html, body’).stop().animate({
‘scrollTop’: $target.offset().top - 70
}, 900, ‘swing’);

Thank you so much in advance and kind regards,
Peter

Hello Peter,

Please replace this code block:


$('html, body').stop().animate({
     'scrollTop': $target.offset().top - 70
}, 900, 'swing');

with:


var distance = 70;

if ( matchMedia( 'only screen and (min-width: 992px) and (max-width: 1024px)' ).matches ) {
  distance =  340;
}

if ( matchMedia( 'only screen and (min-width: 1025px)' ).matches ) {
  distance =  170;
}

$('html, body').stop().animate({
     'scrollTop': $target.offset().top - distance
}, 900, 'swing');

Regards,
Kharis

Dear Kharis,
thanks a ton - it works like a charm!
Best regards,
Peter

Thank you for updating me, Peter. Glad that works for you!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis

Thanks for your outstanding support, Kharis!
Regards,
Peter

You’re most welcome! :slight_smile: