0

Im trying to make my Scrollspy switch to the next section when it reaches 50% of the page height.

I looked at How do I set the offset for ScrollSpy in Bootstrap? and I wasn't able to come up with a solution.

So far i only have the normal data-offset

<body data-spy="scroll" data-target="#mainNavBar" data-offset="200">

Anyone have any ideas on how I can achieve it?

Community
  • 1
  • 1
Recap
  • 168
  • 2
  • 15
  • @D_Supreme Like I said. I tried the solutions they posted and adjusted them to be 50% of the screen but it didnt work. – Recap Jun 03 '16 at 11:09

1 Answers1

1

This seemed to do the trick.

var offsetSize = (screen.height/2);

        //Scrollspy offset
        $("body").scrollspy({target: "#navID", offset:offsetSize});
    });
Recap
  • 168
  • 2
  • 15