EragonJ / Trip.js

🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.
https://eragonj.github.io/Trip.js/
MIT License
793 stars 111 forks source link

Bug scrollTo #190

Open usb248 opened 7 years ago

usb248 commented 7 years ago

On the demo page, this one is broken "Scoll to top when finished". Any scroll is trigger .... I'm on last FF Windows 10...

EragonJ commented 7 years ago

@usb248 what you mean it's broken ? it works well here, any screenshot or console log from inspector ?

usb248 commented 7 years ago

Yes, obviously

cp

I mean, when the tooltip disappear, any scroll isn't triggered...

EragonJ commented 7 years ago

@usb248 ok it's kinda weird. But I don't have such environment (windows 10 + FF) to test it. But the error may be related to jquery based on your screenshot. Can you try to download Trip.js and use different version of jquery to give it a try ? thanks.

parasolx commented 5 years ago

I just review the code and found at line 615:

if (this.settings.backToTopWhenEnded) {
  this.$root.animate({ scrollTop: 0 }, 'slow');
}

The selector return for animate is the root of document which result with "body" element. I can summarized like below: $('html,body') works in chrome, firefox, safari. $('body') works in chrome and safari. $('html') works in firefox.

To make sure it works in most of the browser, the line should directly change like below:

if (this.settings.backToTopWhenEnded) {
   $('html,body').animate({ scrollTop: 0 }, 'slow');
}

Same goes for line 1190: this.$root.animate({ scrollTop: tripBlockTop - OFFSET }, 'slow'); should change to $('html, body').animate({ scrollTop: tripBlockTop - OFFSET }, 'slow');

kojot1234 commented 5 years ago

@EragonJ Would really appreciate if you could merge the above change and make a new release. Thanks.