Topic: How to set SmoothScroll Offset ?

Giovanni De Stefano priority asked 5 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

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 priority commented 5 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

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.5.9
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: No
  • Provided link: Yes