Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter to offset callback function #135

merged 2 commits into from Sep 10, 2019


Copy link

commented Apr 4, 2019

This pull request adds the parameters element and container to the offset() callback function.

Related: #79

It allows to further control the scroll position, for example centering the content:

function centerContent (element) {
  const elHeight = element.clientHeight;
  const winHeight = window.innerHeight;
  let offset = 0;
  if (winHeight > elHeight) {
    offset = -(winHeight - elHeight) * 0.5;
  return offset;

Vue.use(VueScrollTo,  {
  offset: centerContent,
lukasbesch added 2 commits Apr 4, 2019

@rigor789 rigor789 merged commit e862213 into rigor789:master Sep 10, 2019

2 of 5 checks passed

Header rules No header rules processed
Pages changed 6 new files uploaded
Redirect rules No redirect rules processed
Mixed content No mixed content detected
deploy/netlify Deploy preview ready!

This comment has been minimized.

Copy link

commented Sep 10, 2019

🎉 This PR is included in version 2.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rigor789 rigor789 added the released label Sep 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.