0
Issue with part of the JS code on android app
This part of the code works just fine on desktop/sololearn app, but it logs the following error on sololearn android app: Uncaught TypeError: Cannot read property 'scrollInToView' of null. Does it mean that there is no support for scrollInToView() on mobile app? Anyway, code: let btns = document.querySelectorAll('#my_side_menu a'); for ( let btn of btns ) { btn.onclick = function(e) { e.preventDefault(); var href = this.href.match(/([^\/]*)\/*$/)[1]; document.getElementById(href).scrollIntoView({ block: 'start', behavior: 'smooth' }); } } Or you can check it on: https://code.sololearn.com/WswKhRQFvP18/#js Any kind of help is welcome. :)
1 Antwort
+ 2
Hi Vladimir, scroll into view looks like experimental technology. You might want to use CSS prefixes to do similar thing. or with JavaScript window.scroll().
have a look at some of my bolierplate under my code tabs on
https://code.sololearn.com/W7Ptp9xkYbnM/?ref=app
https://code.sololearn.com/WBm588FrW0He/?ref=app