Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d3b981b authored by Paula's avatar Paula
Browse files

add scroll-margin-top to card and use basic scrollIntoView

parent 2682c979
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ button.next:disabled {
/* <header> */
/* <card> */
.card {
    scroll-margin-top: 65px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    max-width: 780px;
    border-radius: 6px;
+2 −18
Original line number Diff line number Diff line
@@ -16,13 +16,13 @@ class ViewManager {
        this.WDebug = wdebug.WDebug;
        const errorManager = await import ("./errorManager.js");
        this.ErrorManager = errorManager.ErrorManager;

        const cm = await import("./controller.manager.js");
        const tm = await import("./vue/translation.manager.js");
        this.controller = new cm.Controller();
        await this.controller.init();
        this.translationManager = new tm.TranslationManager();
        await this.translationManager.init();
        window.scroll(0,0);
    }

    selectStep(currentIndex, step) {
@@ -40,22 +40,6 @@ class ViewManager {
                $processCtn.appendChild($copyStep);
                setTimeout(() => {
                    $copyStep.scrollIntoView({ behavior: "smooth", block: "start"});

                    const headerHeight = document.getElementById('banner').clientHeight;
                    if($copyStep.clientHeight > (window.innerHeight - headerHeight)) {
                        let isScrolling;
                        window.addEventListener('scroll', function onScroll() {
                            clearTimeout(isScrolling);
                            
                            isScrolling = setTimeout(function() {
                                window.scrollBy({
                                    top: -headerHeight,
                                    behavior: 'smooth'
                                });
                                window.removeEventListener('scroll', onScroll);
                            }, 100);
                        });
                    }
                }, 100);
            }
        }