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 animationTarget option to allow to set animation element explicitly. #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dfedynich
Copy link
Contributor

Sometimes it is useful to seperate out the animation target and the DOM object to watch for click events.Using 'body' as the default selector to initialize the plugin is the perfect choice to override jumping behavior and replace it with smooth scrolling over the whole page. But there are some cases, when we want to watch for click events in the specified area only and still want to use 'body' as the animation target. Moreover, existance of an option to separate animation and watching DOM objects will be a good a step in the spirit of modularity.

@dfedynich
Copy link
Contributor Author

Hey, @JamyGolden, the issue, that I was trying to solve consists in the next state. Each jQuery element, which plusAnchor function applies to, serves for two reasons:

  1. It is used as the start point to go through DOM and bind click events to anchors.
  2. It is used as the target element to apply animate function.

What if I want to bind click event to particular anchors inside one specific DOM element, but still want to use "body" as the animation target? It can be really useful if there are other plugins, which work with anchors, and you want to use plusAnchor without any conflicts. The current code doesn't allow to distinguish between target animation element and the element as the start point to look for anchors.

@JamyGolden
Copy link
Owner

Hey, since merging a different pull request, this one now has a merge conflict. Could you please fix that and resubmit?

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

Successfully merging this pull request may close these issues.

2 participants