cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.89k stars 3.82k forks source link

scroller div will not scroll if dynamically populated #1234

Open john-pallissard opened 6 years ago

john-pallissard commented 6 years ago

Trying to set the innerHTML of the scroller div with an AJAX call.. No luck - no scroll..

If I switch developer mode in Chrome to a mobile emulation scrolling starts to work.

If I then switch back to desktop scrolling continues to function.

using a modified version of the "scrollbars" demo

added the following JavaScript:

john-pallissard commented 6 years ago

Fixed my own issue!! Call loaded() just after the div has been populated by the XMLHttpRequest instead of during the onload() event