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
merged 2 commits into from Sep 10, 2019

Conversation

@lukasbesch
Copy link
Contributor

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
Details
Pages changed 6 new files uploaded
Details
Redirect rules No redirect rules processed
Details
Mixed content No mixed content detected
Details
deploy/netlify Deploy preview ready!
Details
@rigor789

This comment has been minimized.

Copy link
Owner

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
Projects
None yet
2 participants
You can’t perform that action at this time.