I'm using Scroll Magic for a sticky side nav. I would like the side nav to STOP right before the next section but as of now the duration endpoint is showing about 200px below where I would want. How do you set a custom endpoint regardless of the height of the content? I tried adding a negative value to the height of the duration point but then on certain pages where the height was smaller it did not work and overflowed into the next section. My ideal outcome is the sticky nav ALWAYS stops about 15px before the bottom of the .center-tab-content section.
if ($('.container--tab-navigation').length) {
var pinPageNavController = new ScrollMagic.Controller(),
pinPageScene = new ScrollMagic.Scene({
triggerElement: '.l-side-nav',
triggerHook: 'onLeave',
duration: getHeightDuration,
})
.addIndicators({ name: '2 (duration: 0)' }) // add indicators (requires plugin)
.addTo(pinPageNavController);
pinPageScene.setPin('.l-side-nav', { pushFollowers: false });
function getHeightDuration() {
var heightDuration = Number($('.center-tab-content').height());
return heightDuration;
}
}