question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not compatible with safari

See original GitHub issue

These two lines not works in safari, because safari doesn’t respect document.documentElement.scrollTop/Left

https://github.com/terwanerik/ScrollTrigger/blob/56b4b04695ad3be2d69aa406cfd88746d194192f/ScrollTrigger.js#L548-L549

This is a complicated topic, so I just put a reference here, it is up to you to decide choose which solution: https://stackoverflow.com/questions/20514596/document-documentelement-scrolltop-return-value-differs-in-chrome/33462363#33462363

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
terwanerikcommented, Sep 21, 2018

Ah alright i see, yeah the bindElement is used when you want to trigger classes inside a scrolling div.

For example (untested code);

<div class="wrap">
  <div data-scroll></div>
  <div data-scroll></div>
  <div data-scroll></div>
</div>
.wrap {
  height: 500px;
  overflow-y: scroll;
}

.wrap div[data-scroll] {
  height: 300px;
  width: 100%;
  background: red;
}
var wrapper = document.querySelector('.wrap');

/** 
  * First parameter = options
  * Second parameter = bindElement (where to fetch the [data-scroll] elements from)
  * Last parameter = the element to listen for `scroll` event, so the custom wrapper
  */
new ScrollTrigger({}, document.body, wrapper);

It then adds the scroll listener to the .wrap div, and checks the scrollTop from .wrap. In most cases you’d leave bindElement alone.

0reactions
nightirecommented, Sep 21, 2018

@terwanerik Ah, that makes sense now. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

If Safari on Mac doesn't open a webpage or isn't working as ...
The webpage might not be compatible with one or more browser settings, which you can turn on or off as needed. From the...
Read more >
3 Ways to Fix This Version of Safari is No Longer Supported
1. Update the Safari Browser · Click Software Update in System Preferences. · Check the option marked Automatically keep my Mac up to...
Read more >
How to fix 'This version of Safari is no longer supported ... - iMore
How to fix 'This version of Safari is no longer supported' messages ... Older versions of OS X don't get the newest fixes...
Read more >
Why do so many websites still not work properly with ... - Quora
Different rendering engines. Chrome uses Blink, while Safari uses WebKit. · Safari is a native application, Chrome is not. · Chrome has vastly...
Read more >
Change or update your browser for a better experience
Supported browsers. Google One no longer supports Internet Explorer. ... Google One supports Google Chrome, Firefox, MS Edge, Safari, and Opera.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found