Topic: how to make the global scrollspy?

Zhe Lee pro asked 4 years ago

The scroll spy now seems a nested scroll spy it can only spy the scroll nested in a page. The spied content is defined like this<div class="scrollspy-example z-depth-1 mt-4" data-spy="scroll" data-target="#navbar-example2" data-offset="0">If I remove the "scrollspy-example" the content become whole page content. And the scrollspy not work again.So how to make global scrollspy.

Jakub Strebeyko staff answered 4 years ago

Zhe Lee 你好, Thanks for sharing your issue here. The easiest way of debugging HTML/CSS is using Chrome browser with DevTools enabled. In the Elements tab there you can check many different aspects of HTML elements and their CSS properties added inline-y or through classes. Using the tool would have you stop guessing and realize truth once and for all: .scrollspy-example class you copied sets the <div>'s height property to 200px;. Edit the class or create your own in the CSS file. With Best Regards, Kuba

Jakub Strebeyko staff answered 4 years ago

Zhe Lee 你好, Thanks for reaching out again. Please include your code and an explanation of what exactly you are trying to achieve. We are unable to help you without it. 谢谢. With Best Regards, Kuba

Zhe Lee pro commented 4 years ago

Thank you for your reply, ,Here is my code As you see, The scroll spy embed in the web page not global, , Which means we can see two scroll spy in the cage, I just want one, The outside one. And how to spy the scroll bar on that,


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



Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No