diff --git a/plugin.js b/plugin.js index f55187f..75e9c73 100644 --- a/plugin.js +++ b/plugin.js @@ -135,10 +135,29 @@ return html; }; - // Required by ActivitySlide contract. Navigation/focus/scroll are handled by - // the native Lampa.Scroll (it registers its own Controller and auto-scrolls). - // Back (Escape / remote) is handled via the keydown listener in create(). + // Required by ActivitySlide contract. Scroll (created in create()) owns the + // auto-scroll; we register a Controller that drives Navigator over the cards. + // Focus is set on the first card only once (no reset on re-toggle). this.start = function () { + var started = false; + Lampa.Controller.add('content', { + toggle: function () { + var wrap = $('.mymovies'); + var cards = wrap.find('.card.selector'); + if (!cards.length) return; + Lampa.Controller.collectionSet(wrap); + if (!started) { + started = true; + Lampa.Controller.collectionFocus(cards[0], wrap); + } + }, + 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'); }, + back: function () { Lampa.Activity.backward(); } + }); + Lampa.Controller.toggle('content'); }; // Build each card and append through the native Scroll (handles focus + scroll).