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

Feature Request: Mousewheel exececutes pageScroll #87

Closed
csawtelle opened this issue Feb 24, 2017 · 1 comment
Closed

Feature Request: Mousewheel exececutes pageScroll #87

csawtelle opened this issue Feb 24, 2017 · 1 comment

Comments

@csawtelle
Copy link

csawtelle commented Feb 24, 2017

It would be really nice if you could bind the page scroll even to a mousewheel click. Currently you have to click an element to move to the anchor, such as this:

<div class="hover_bar">
      <a pageScroll href="#scroll_anchor" class="more" #hover_trigger></a>
      <i class="fa fa-arrow-down" aria-hidden="true" (mouseover)='hover_trigger.click()'></i>
</div>

It would be really nice if you could do something like

(mousewheeldown)="hover_trigger"

so that a scroll down on the mouse would take you to the specified anchor, equivalently mousewheelup could specify a separate anchor.

@Nolanus
Copy link
Owner

Nolanus commented Feb 25, 2017

Hi,

thanks for your suggestion, but I assume that use case is quite specific and adding it to the the "core" ng2-page-scroll just increases the libraries complexity with a few people using it.

Anyhow, this could easily be implemented by binding to the window scroll event and triggering the scroll animation using the PageScrollService. Therefore it's just another trigger for executing a scroll animation.

@Component({
// Your component stuff here
})
export class MyComponent {
 constructor(@Inject(DOCUMENT) private document: Document, private pageScrollService: PageScrollService) { }

  @HostListener("window:scroll", ['$event'])
  onWindowScroll(event) {
     // Read data from the scroll event and create a pageScrollInstance
     let pageScrollInstance: PageScrollInstance = null; // TODO
     this.pageScrollService.start(pageScrollInstance);
  }
}

@Nolanus Nolanus mentioned this issue Feb 25, 2017
@Nolanus Nolanus closed this as completed Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants