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

Update event never change after first update #277

Open
andresgutgon opened this issue Dec 17, 2017 · 3 comments
Open

Update event never change after first update #277

andresgutgon opened this issue Dec 17, 2017 · 3 comments
Labels
bug hacktoberfest hacktoberfest issues for newer contributors

Comments

@andresgutgon
Copy link

andresgutgon commented Dec 17, 2017

Hi, I'm trying to get notified when attachment and targetAttachment element change: top and left positions.

I'm initializing tether with this settings:

            var tether = new Tether({
                attachment: 'bottom center',
                targetAttachment: 'top center',
            });

As you can see. attachment is vertically positioned bottom and targetAttachment is vertically positioned with top.

When I scroll the page I expect to change attachment to top and targetAttachment to bottom. And I want to receive this info on update event like this:

            tether.on('update', function(event) {
              $('.element').html(`
                  attachment.top: ${event.attachment.top}
                  targetAttachment.top: ${event.targetAttachment.top}
              `)
            });

And it works first time 🎉 .
But if I scroll .element to initial position targetAttachment and attachment vertical position is not updated to their initial position.

Check this gif and see how
update-event

Code pen with example:

https://codepen.io/andresgutgon/pen/JMYgyx?editors=1000

@andresgutgon
Copy link
Author

I think the issue is here: https://github.com/HubSpot/tether/blob/master/src/js/constraint.js#L345

Initial targetAttachment.top is === when you scroll back to initial page position (in my example). So change is not detected and event is not fired

@chuckcarpenter chuckcarpenter added the hacktoberfest hacktoberfest issues for newer contributors label Oct 1, 2019
@raghavbk
Copy link

raghavbk commented Oct 3, 2021

@andresgutgon can i work on this issue

@andresgutgon
Copy link
Author

Sure! go ahead 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug hacktoberfest hacktoberfest issues for newer contributors
Projects
None yet
Development

No branches or pull requests

4 participants