How to set SmoothScroll Offset ?


Topic: How to set SmoothScroll Offset ?

Giovanni De Stefano (zxxz) pro premium priority asked 6 years ago

Hello, I am using a fixed top nav bar. How can I set the offset for SmoothScroll? I see the option available in Angular version but not in the jQuery version (I have the pro version of both). Thank you, Giovanni

Bartłomiej Malanowski staff pro premium answered 6 years ago

Hi, Giovanni! Please add data-offset="<any value you want>" to your <a> element. Here's an example:
<ul class="nav nav-pills default-pills smooth-scroll">
    <li class="nav-item"><a class="nav-link" href="#sectionOne" data-offset="100">Section with offset</a></li>
    <li class="nav-item"><a class="nav-link" href="#sectionTwo">No offset</a></li>
</ul>

Giovanni De Stefano (zxxz) pro premium priority commented 6 years ago

Hello Bartłomiej, Thank you so much!!!! ? It works perfectly! Cheers, Giovanni

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.5.9
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: No
  • Provided link: Yes