Reputation: 1706
My problem is simple, but I can't seem to figure it out! My javascript should not deduct 100 pixels, i want 100% of viewport!
smoothScrollTo(document.getElementById('bottom').offsetTop - 100)
should look like:
smoothScrollTo(document.getElementById('bottom').offsetTop - '100%')
but for some reason this is not working.
The answer must be in Javascript (cannot use jQuery).
Upvotes: 1
Views: 68
Reputation: 5742
What about this?
var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
smoothScrollTo(document.getElementById('bottom').offsetTop - viewportHeight )
Upvotes: 1