diff --git a/plugin.js b/plugin.js index 42faf30..26bcf96 100644 --- a/plugin.js +++ b/plugin.js @@ -61,7 +61,7 @@ // Only layout wrappers; the movie cards and detail screen use NATIVE Lampa // styles (.card / .full-start-new / .full-descr / .full-start__button). var css = - '.mymovies{padding:2.2em 3.4em;height:100%;box-sizing:border-box}' + + '.mymovies{padding:2.2em 3.4em;overflow-y:auto;height:100%;box-sizing:border-box}' + // Cards live inside the native Lampa.Scroll content wrapper. '.mymovies .scroll__content{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:1.4em}' + '.mymovies-detail{padding:2em 3em;box-sizing:border-box}' + @@ -153,10 +153,14 @@ }, left: function () { if (Navigator.canmove('left')) Navigator.move('left'); else Lampa.Controller.toggle('menu'); }, right: function () { Navigator.move('right'); }, - up: function () { Navigator.move('up'); }, - down: function () { Navigator.move('down'); }, + up: function () { Navigator.move('up'); setTimeout(scrollFocused, 30); }, + down: function () { Navigator.move('down'); setTimeout(scrollFocused, 30); }, back: function () { Lampa.Activity.backward(); } }); + function scrollFocused() { + var el = document.querySelector('.mymovies .card.selector.focus'); + if (el && el.scrollIntoView) el.scrollIntoView({ block: 'nearest', behavior: 'auto' }); + } Lampa.Controller.toggle('content'); };