Dropdown menu on mobile

<script>
    // ONLY using for demo
    $("body").css({
        "padding": "",
        "margin": ""
    });
</script>

<!-- MENU BEGIN -->
<div id="menu-dropdown-anchor"></div>
<div class="rh-menu-dropdown only-sm">
    <div class="rh-menu-dropdown__header">
        <div class="rh-menu-dropdown__header-logo-container">
            <a href="#">
                <img class="rh-menu-dropdown__header-logo" src="/images/logo.svg">
            </a>
        </div>

        <div class="rh-round-button rh-menu-dropdown__menu-round-button">
            <span class="icon-menu rh-menu-dropdown__icon-menu"></span>
        </div>
    </div>

    <div class="rh-menu-dropdown__body">

        <div>
            <div class="rh-menu-dropdown__item">
                <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Startsida</a>
            </div>

        </div>

        <div>
            <div class="rh-menu-dropdown__item">
                <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Evenemang</a>
            </div>

        </div>

        <div>
            <div class="rh-menu-dropdown__item">
                <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Vad vi gör</a>
                <div id="3" class="rh-round-button rh-round-button--small rh-menu-dropdown__item-round-button">
                    <span class="icon-minus rh-menu-dropdown__icon-item"></span>
                </div>
            </div>

            <div id="sub3" class="rh-menu-dropdown__item__sub-container">
                <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-3">
                    <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Imagine</a>
                </div>

            </div>
        </div>

        <div>
            <div class="rh-menu-dropdown__item">
                <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Om oss</a>
                <div id="4" class="rh-round-button rh-round-button--small rh-menu-dropdown__item-round-button">
                    <span class="icon-minus rh-menu-dropdown__icon-item"></span>
                </div>
            </div>

            <div id="sub4" class="rh-menu-dropdown__item__sub-container">
                <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-3">
                    <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Vår vision</a>
                </div>

                <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-3">
                    <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Kontakt</a>
                    <div id="42" class="rh-round-button rh-round-button--small rh-menu-dropdown__item-round-button">
                        <span class="icon-minus rh-menu-dropdown__icon-item"></span>
                    </div>
                </div>

                <div id="sub42" class="rh-menu-dropdown__item__sub-container">
                    <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-5">
                        <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Anna Larsson</a>
                    </div>
                    <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-5">
                        <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Eva Andersson</a>
                    </div>
                    <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-5">
                        <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Filip Aurel</a>
                    </div>
                    <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-5">
                        <a href="#" class="rh-link--navigation rh-menu-dropdown__text">Joh Ahlin</a>
                    </div>
                </div>
            </div>
        </div>

        <div>
            <div class="rh-menu-dropdown__item">
                <a href="#" class="rh-link--navigation rh-menu-dropdown__text">För press</a>
            </div>

        </div>

        <div>
            <div class="rh-menu-dropdown__item rh-menu-dropdown__footer">
                <a href="#" class="rh-link--navigation rh-menu-dropdown__text rh-menu-dropdown__footer-text">In English</a>
            </div>
        </div>
    </div>
</div>
<div class="rh-menu-dropdown__spacing-after"></div>
<!-- MENU END -->

<!-- Using for scrolling testing -->
Scale your screen to under 768px for viewing how the menu works! Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#x27;s standard dummy text ever since the 1500s, when an unknown printer took
a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of letraset sheets
containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Scale your screen to under 768px for viewing how the menu works! Lorem Ipsum is simply dummy text of the printing
and typesetting industry. Lorem Ipsum has been the industry&#x27;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also
the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including
versions of Lorem Ipsum. Scale your screen to under 768px for viewing how the menu works! Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#x27;s standard dummy text ever since the 1500s, when
an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release
of letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<!-- End of scrolling testing -->
<script>
    // ONLY using for demo
    $("body").css({ "padding": "", "margin": "" });
</script>

<!-- MENU BEGIN -->
<div id="menu-dropdown-anchor"></div>
<div class="rh-menu-dropdown only-sm">
    <div class="rh-menu-dropdown__header">
        <div class="rh-menu-dropdown__header-logo-container">
            <a href="{{header.link}}">
                <img class="rh-menu-dropdown__header-logo" src="{{header.logo}}">
            </a>
        </div>

        <div class="rh-round-button rh-menu-dropdown__menu-round-button">
            <span class="icon-menu rh-menu-dropdown__icon-menu"></span>
        </div>
    </div>

    <div class="rh-menu-dropdown__body">
        {{#each body.items}}{{!-- Level 1 - Root --}}
        <div>
            <div class="rh-menu-dropdown__item">
                <a href="{{link}}" class="rh-link--navigation rh-menu-dropdown__text">{{text}}</a>
                {{#if subItems}}
                <div id="{{id}}" class="rh-round-button rh-round-button--small rh-menu-dropdown__item-round-button">
                    <span class="icon-minus rh-menu-dropdown__icon-item"></span>
                </div>
                {{/if}}
            </div>

            {{#if subItems}} {{!-- Level 2 --}}
            <div id="sub{{id}}" class="rh-menu-dropdown__item__sub-container">
                {{#each subItems}}
                <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-3">
                    <a href="{{link}}" class="rh-link--navigation rh-menu-dropdown__text">{{text}}</a>
                    {{#if subItems}}
                    <div id="{{id}}" class="rh-round-button rh-round-button--small rh-menu-dropdown__item-round-button">
                        <span class="icon-minus rh-menu-dropdown__icon-item"></span>
                    </div>
                    {{/if}}
                </div>

                {{#if subItems}}{{!-- Level 3 --}}
                <div id="sub{{id}}" class="rh-menu-dropdown__item__sub-container">
                    {{#each subItems}}
                    <div class="rh-menu-dropdown__item rh-menu-dropdown__item__sub-item rh-pl-5">
                        <a href="{{link}}" class="rh-link--navigation rh-menu-dropdown__text">{{text}}</a>
                    </div>
                    {{/each}}
                </div>
                {{/if}}
                {{/each}}
            </div>
            {{/if}}
        </div>
        {{/each}}

        <div>
            <div class="rh-menu-dropdown__item rh-menu-dropdown__footer">
                <a href="{{footer.link}}"
                    class="rh-link--navigation rh-menu-dropdown__text rh-menu-dropdown__footer-text">{{footer.text}}</a>
            </div>
        </div>
    </div>
</div>
<div class="rh-menu-dropdown__spacing-after"></div>
<!-- MENU END -->

{{#if sampleContent}}
<!-- Using for scrolling testing -->
{{sampleContent}}
{{sampleContent}}
{{sampleContent}}
<!-- End of scrolling testing -->
{{/if}}
{
  "header": {
    "logo": "/images/logo.svg",
    "link": "#"
  },
  "body": {
    "items": [
      {
        "id": 1,
        "text": "Startsida",
        "link": "#"
      },
      {
        "id": 2,
        "text": "Evenemang",
        "link": "#"
      },
      {
        "id": 3,
        "text": "Vad vi gör",
        "link": "#",
        "subItems": [
          {
            "id": 31,
            "text": "Imagine",
            "link": "#"
          }
        ]
      },
      {
        "id": 4,
        "text": "Om oss",
        "link": "#",
        "subItems": [
          {
            "id": 41,
            "text": "Vår vision",
            "link": "#"
          },
          {
            "id": 42,
            "text": "Kontakt",
            "link": "#",
            "subItems": [
              {
                "id": 421,
                "text": "Anna Larsson",
                "link": "#"
              },
              {
                "id": 422,
                "text": "Eva Andersson",
                "link": "#"
              },
              {
                "id": 423,
                "text": "Filip Aurel",
                "link": "#"
              },
              {
                "id": 424,
                "text": "Joh Ahlin",
                "link": "#"
              }
            ]
          }
        ]
      },
      {
        "id": 5,
        "text": "För press",
        "link": "#"
      }
    ]
  },
  "footer": {
    "text": "In English",
    "link": "#"
  },
  "sampleContent": "Scale your screen to under 768px for viewing how the menu works! Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
}
  • Content:
    /* Needed components
    @import '../../Atoms/link/_link.scss';
    @import '../../Atoms/round-button/_round-button.scss';
    */
    
    /* Mobile dropdown menu - Displays only in SM mode with screen size < 768px*/
    .rh-menu-dropdown {
        /* Positionering */
        position: $menu-dropdown__position; // Using when JS is inactivated
        top: $menu-dropdown__position--top;
        z-index: $menu-dropdown--z-index;
    
        /* Box-modell/beteende */
        width: $menu-dropdown--width;
        min-width: $menu-dropdown--min-width;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    
        &__header {
            /* Box-modell/beteende */
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            justify-content: space-between;
            align-items: center;
    
            height: $menu-dropdown__header--height;
            padding: $menu-dropdown__header--padding;
            overflow: hidden;
            -webkit-transition: $menu-dropdown__header-effect-webkit;
            transition: $menu-dropdown__header-effect;
    
            /* Typografi */
            background-color: $menu-dropdown__color-background-header;
    
            &-logo-container {
                /* Box-modell/beteende */
                display: block;
                width: $menu-dropdown__header-logo-container--width;
                max-height: $menu-dropdown__header-logo-container--max-height;
                max-width: $menu-dropdown__header-logo-container--max-width;
            }
    
            &-logo {
                /* Box-modell/beteende */
                display: block;
                width: $menu-dropdown__header-logo--width;
            }
    
            &--minimize {
                /* Box-modell/beteende */
                height: 0;
            }
    
            &--shadow {
                /* Box-modell/beteende */
                box-shadow: $menu-dropdown__header-effect--box-shadow;
            }
        }
    
        &__body {
            /* Box-modell/beteende */
            width: $menu-dropdown__body--width;
            background-color: $menu-dropdown__color-background-body;
    
            @if $menu-dropdown__body--min-width {
                min-width: $menu-dropdown__body--min-width;
            }
            @if $menu-dropdown__body--max-width {
                max-width: $menu-dropdown__body--max-width;
            }
    
            // Right body menu is using with max-width
            @if $menu-dropdown__body-position == right {
                /* Positionering */
                position: absolute;
                right: 0px;
            }
        }
    
        &__text {
            margin: 0;
    
            /* Typografi */
            font-size: $menu-dropdown__text--font-size;
            line-height: $menu-dropdown__text--line-height;
    
            &--active {
                font-weight: $menu-dropdown__text--active--font-weight;
            }
        }
    
        &__icon {
            &-menu {
                /* Box-modell/beteende */
                display: block;
                margin: $menu-dropdown__icon-menu--margin;
            }
    
            &-item {
                /* Box-modell/beteende */
                display: block;
                margin: $menu-dropdown__icon-item--margin;
            }
        }
    
        &__menu {
            &-round-button {
                /* Box-modell/beteende */
                padding: $menu-dropdown__button-main-menu--padding;
                height: $menu-dropdown__button-main-menu--height;
                width: $menu-dropdown__button-main-menu--width;
    
                /* Visuellt */
                border: $menu-dropdown__button-main-menu--border;
                text-align: center;
    
                /* Typografi */
                color: $menu-dropdown__color-text--active;
                background-color: $menu-dropdown__color-main;
    
                /* Blandat/övrigt */
                cursor: pointer;
    
                &:hover,
                &:active {
                    /* Typografi */
                    color: $menu-dropdown__color-text--active;
                    background-color: $menu-dropdown__color-main;
                }
    
                &--open {
                    /* Typografi */
                    color: $menu-dropdown__color-main;
                    background-color: $menu-dropdown__color-background--active;
    
                    &:hover,
                    &:active {
                        /* Typografi */
                        color: $menu-dropdown__color-main;
                        background-color: $menu-dropdown__color_background--active;
                    }
                }
            }
        }
    
        &__item {
            /* Box-modell/beteende */
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            justify-content: space-between;
            align-items: center;
    
            min-height: $menu-dropdown__item--min-height;
            padding: $menu-dropdown__item--padding;
    
            /* Boder style */
            border-style: $menu-dropdown__item--border-style;
            border-color: $menu-dropdown__item--border-color;
            border-width: $menu-dropdown__item--border-width; // 1px
    
            /* Typografi */
            background-color: $menu-dropdown__color-background-item;
    
            &-round-button {
                /* Box-modell/beteende */
                margin: $menu-dropdown__item-button--margin;
                height: $menu-dropdown__item-button--height;
                width: $menu-dropdown__item-button--width;
    
                /* Visuellt */
                border: $menu-dropdown__item-button--border;
    
                /* Typografi */
                color: $menu-dropdown__color-text--active;
                background-color: $menu-dropdown__color-main;
    
                /* Blandat/övrigt */
                cursor: pointer;
    
                &:hover,
                &:active {
                    /* Typografi */
                    color: $menu-dropdown__color-text--active;
                    background-color: $menu-dropdown__color-main;
                }
    
                &--open {
                    /* Visuellt */
                    border: $menu-dropdown__item-button--open--border;
    
                    /* Typografi */
                    color: $menu-dropdown__color-main;
                    background-color: $menu-dropdown__color-background--active;
    
                    &:hover,
                    &:active {
                        /* Typografi */
                        color: $menu-dropdown__color-main;
                        background-color: $menu-dropdown__color-background--active;
                    }
                }
            }
    
            &__sub {
                &-container {
                    /* Box-modell/beteende */
                    display: block;
                }
    
                &-item {
                    /* Typografi */
                    background-color: $menu-dropdown__color-background-item-sub;
                }
            }
    
            &--active {
                /* Typografi */
                font-weight: bold;
                background-color: $menu-dropdown__color-main;
    
                .rh-menu-dropdown__item-round-button {
                    /* Typografi */
                    color: $menu-dropdown__color-main;
                    background-color: $menu-dropdown__color-background--active;
                }
    
                .rh-menu-dropdown__footer-text {
                    /* Typografi */
                    color: $black;
                }
            }
        }
    
        &__footer {
            /* Box-modell/beteende */
            min-height: $menu-dropdown__footer--min-height;
    
            &-text {
                /* Typografi */
                color: $menu-dropdown__color-text-footer;
            }
        }
    
        &__spacing {
            &-after {
                &--active {
                    /* Box-modell/beteende */
                    height: $menu-dropdown__header--height;
    
                    @include medium {
                        /* Box-modell/beteende */
                        display: none;
                    }
                }
            }
        }
    
        &--open {
            /* Positionering */
            right: $menu-dropdown__position--right;
            bottom: $menu-dropdown__position--bottom;
            left: $menu-dropdown__position--left;
    
            /* Box-modell/beteende */
            overflow-y: scroll;
            overscroll-behavior: contain;
            
            /* Typografi */
            background-color: $menu-dropdown__color-overlay;
        }
    
        &-position {
            &--fixed {
                position: fixed;
            }
        }
    
        &-display {
            &--none {
                display: none;
            }
    
            &--show {
                display: block;
            }
        }
    }
    
  • URL: /components/raw/menu-mobile/_menu-mobile.scss
  • Filesystem Path: components/Molecules/menu-mobile/_menu-mobile.scss
  • Size: 8.1 KB
  • Content:
    {
        "name": "regionhalland/menu-mobile",
        "description": "menu-mobile",
        "type": "styleguide-molecule",
        "license": "GPL-3.0",
        "authors": [
            {
                "name": "Region Halland",
                "email": "webbplatser@regionhalland.se"
            }
        ],
        "require": {}
    }
  • URL: /components/raw/menu-mobile/composer.json
  • Filesystem Path: components/Molecules/menu-mobile/composer.json
  • Size: 291 Bytes
  • Content:
    /* Needed helpers in /public/library.js
        throttle()
        calculateScrollbarWidth()
        isMobileDevice()
        Needed library: bodyScrollLock-2.6.3.min.js
    */
    
    $(document).ready(function () {
        // Global variables
        var scrollbarWidth = calculateScrollbarWidth(),
            isMenuPositionTypeFixed = false,
            menuLastPosition = 0,
            isMinimize = false;
    
        var onloadScreenSize = $(document).width(),
            maxScreenSizeForDisplaying = 767,// 767px
            isMobileScreen = onloadScreenSize <= maxScreenSizeForDisplaying;
    
        // Menu's element definitions
        var $body = $("body"),
            $menuDropDownAnchorId = $("#menu-dropdown-anchor"),
            $menuSpacingAfter = $(".rh-menu-dropdown__spacing-after"),
            $menuDropDown = $(".rh-menu-dropdown"),
            $menuDropDownHeader = $(".rh-menu-dropdown__header"),
            $menuDropDownBody = $(".rh-menu-dropdown__body"),
            $menuDropDownSubContainers = $(".rh-menu-dropdown__item__sub-container"),
            $menuSubItemIcons = $(".rh-menu-dropdown__icon-item");
    
        // Initial state for the menu when JS is activated in web browser
        $menuDropDownBody.addClass("rh-menu-dropdown-display--none");
        $menuDropDownSubContainers.addClass("rh-menu-dropdown-display--none");
        $menuSubItemIcons.toggleClass("icon-minus icon-plus");
    
        // Check screen size
        $(window).resize(function () {
            scrollbarWidth = calculateScrollbarWidth();
    
            if ($(document).width() <= maxScreenSizeForDisplaying) {
                if (!isMobileScreen) {
                    isMobileScreen = true;
                }
            } else {
                if (isMobileScreen) {
                    isMobileScreen = false;
                }
            }
        });
    
        // EventListener for the menu
        $(document).scroll(throttle(function () {
            if (isMobileScreen) {
                // Determine the menu's type (fixed or relative)
                var menuPosInfo = getElementTopById($menuDropDownAnchorId);
    
                if (menuPosInfo.isOverViewport) {
                    changeToFixedPosition(true, function () {
                        $menuDropDownHeader.addClass("rh-menu-dropdown__header--shadow");
                    });
                } else {
                    changeToFixedPosition(false, function () {
                        $menuDropDown.css({ "top": 0 });
                        $menuDropDownHeader.removeClass("rh-menu-dropdown__header--shadow");
                    });
                }
    
                // Minimize the menu when scrolling down/up for a better user experience
                var menuCurrentPosition = $(this).scrollTop(),
                    menuSpacingAfterPosInfo = getElementTopById($menuSpacingAfter),
                    menuOffset = $menuSpacingAfter.height() * -1;
    
                // Scroll up
                if (menuCurrentPosition < menuLastPosition) {
                    if (isMinimize) {
    
                        $menuDropDownHeader.removeClass("rh-menu-dropdown__header--minimize");
                        isMinimize = !isMinimize;
                    }
                } // Scroll down
                else if (menuCurrentPosition > menuLastPosition) {
                    if (!isMinimize &&
                        menuPosInfo.isOverViewport &&
                        menuSpacingAfterPosInfo.viewportTop <= menuOffset) {
    
                        $menuDropDownHeader.addClass("rh-menu-dropdown__header--minimize");
                        isMinimize = !isMinimize;
                    }
                }
    
                menuLastPosition = menuCurrentPosition;
            }
        }, 100));
    
        // Main menu button
        $(".rh-menu-dropdown__menu-round-button").click(function () {
            $(this)
                .toggleClass("rh-menu-dropdown__menu-round-button--open")
                .find(".rh-menu-dropdown__icon-menu")
                .toggleClass("icon-x icon-menu");
    
            $menuDropDown.toggleClass("rh-menu-dropdown--open");
            $menuDropDownBody.toggleClass("rh-menu-dropdown-display--none rh-menu-dropdown-display--show");
    
            /* Enhanced */
            var menuCurrentPosInfo = getElementTopById($menuDropDownAnchorId);
            if ($menuDropDownBody.is(":visible")) { // Menu is opened
                if (menuCurrentPosInfo.isOverViewport) {
                    lockBodyScrolling(true, makeScrollBarOffset(true));
                } else { // Menu is on top
                    //-> Change position from "relative" to "fixed" by add fixed-class
                    var topPos = menuCurrentPosInfo.bodyTop ?
                        menuCurrentPosInfo.viewportTop : // Offset for above elements
                        menuCurrentPosInfo.fromTop;
    
                    changeToFixedPosition(true, function () {
                        $menuDropDown.css({ "top": topPos });
                        lockBodyScrolling(true, makeScrollBarOffset(true));
                    });
                }
    
            } else { // Menu is closed - Reset all to default
                if (menuCurrentPosInfo.isOverViewport) {
                    lockBodyScrolling(false, makeScrollBarOffset(false));
                } else { // Menu is on top
                    //-> Change back position from "fixed" to "relative" by remove fixed-class
                    changeToFixedPosition(false, function () {
                        $menuDropDown.css({ "top": 0 });
                        lockBodyScrolling(false, makeScrollBarOffset(false));
                    });
                }
            }
        });
    
        // Item button
        $(".rh-menu-dropdown__item-round-button").click(function () {
            var $menuItemButton = $(this),
                $menuItemSubContainer = $("#sub" + $menuItemButton.attr('id')); // Menu item's sub container ID
    
            $menuItemButton
                .toggleClass("rh-menu-dropdown__item-round-button--open")
                .find(".rh-menu-dropdown__icon-item")
                .toggleClass("icon-minus icon-plus");
    
            $menuItemSubContainer.toggleClass("rh-menu-dropdown-display--none rh-menu-dropdown-display--show");
        });
    
        // Item link
        $(".rh-menu-dropdown__body a").click(function () {
            var menuItemClassName = "rh-menu-dropdown__item";
    
            // Reset all and only the latest clicked item is activated
            $(".rh-menu-dropdown__item--active").removeClass("rh-menu-dropdown__item--active");
            $(this)
                .closest("div[class^='" + menuItemClassName + "']")
                .addClass("rh-menu-dropdown__item--active");
        });
    
        /* Common functions */
        function changeToFixedPosition(status, fnCallback) {
            var done = false;
    
            if (status && !isMenuPositionTypeFixed) {
                $menuDropDown.addClass("rh-menu-dropdown-position--fixed");
                $menuSpacingAfter.addClass("rh-menu-dropdown__spacing-after--active");
                isMenuPositionTypeFixed = !isMenuPositionTypeFixed;
    
                done = true;
    
            } else if (!status && isMenuPositionTypeFixed) {
                $menuDropDown.removeClass("rh-menu-dropdown-position--fixed");
                $menuSpacingAfter.removeClass("rh-menu-dropdown__spacing-after--active");
                isMenuPositionTypeFixed = !isMenuPositionTypeFixed;
    
                done = true;
            }
    
            done && typeof fnCallback === 'function' && fnCallback();
        }
    
        function lockBodyScrolling(status, fnCallback) {
            //github.com/willmcpo/body-scroll-lock
            var disableBodyScroll = bodyScrollLock.disableBodyScroll,
                enableBodyScroll = bodyScrollLock.enableBodyScroll;
    
            var targetElement = document.querySelector(".rh-menu-dropdown");
    
            if (status) {
                $body.addClass("rh-noscroll");
                isMobileDevice() && disableBodyScroll(targetElement);
            } else {
                $body.removeClass("rh-noscroll");
                isMobileDevice() && enableBodyScroll(targetElement);
            }
    
            typeof fnCallback === 'function' && fnCallback();
        }
    
        function makeScrollBarOffset(status) {
            if (status) {
                $body.css({ "margin-right": scrollbarWidth });
            } else {
                $body.css({ "margin-right": "" }); // Reset to default
            }
        }
    
        /* Helpers */
        function getElementTopById($elementId) {
            if (!$elementId) {
                throw new Error("$elementId is missing");
            }
    
            var bodyTop = $(window).scrollTop(),
                elementTop = $elementId.length ? $elementId.position().top : 0,
                viewportTop = elementTop - bodyTop,
                isOverViewportTop = bodyTop >= elementTop;
    
            return {
                bodyTop: bodyTop,
                fromTop: elementTop,
                viewportTop: viewportTop,
                isOverViewport: isOverViewportTop
            };
        }
    
        /* function calculateScrollbarWidth() {
            return (window.innerWidth - $(document).width());
        }
    
        function isMobileDevice(){
            return !!navigator.platform && /iPad|iPhone|iPod/g.test(navigator.platform);
        } */
    });
    
  • URL: /components/raw/menu-mobile/menu-mobile.js
  • Filesystem Path: components/Molecules/menu-mobile/menu-mobile.js
  • Size: 8.7 KB
  • Content:
    /* Molecules - Menu mobile */
    // Position
    $menu-dropdown--z-index: 30;
    $menu-dropdown__position: relative;
    $menu-dropdown__position--top: 0;
    $menu-dropdown__position--right: 0;
    $menu-dropdown__position--bottom: 0;
    $menu-dropdown__position--left: 0;
    
    $menu-dropdown__color-main: $base3-dark; //Example: #FA3CB4;
    
    $menu-dropdown__color-background-header: #EEE7DB;
    $menu-dropdown__color-background-body: #FBF9F4;
    $menu-dropdown__color-background-item: #FBF9F4;
    $menu-dropdown__color-background-item-sub: #EEE7DB;
    
    $menu-dropdown__color-overlay: rgba(0, 0, 0, 0.3);
    $menu-dropdown__color-background--active: $white;
    $menu-dropdown__color-text--active: $white;
    $menu-dropdown__color-text-footer: $grey-darker;
    
    // Size
    $menu-dropdown--width: 100%;
    $menu-dropdown--min-width: 20em; // 320px iPhone 5
    $menu-dropdown--max-width: false; // Default is false (max-width: 100%)
    
    $menu-dropdown__text--font-size: 1.125em; // 18px
    $menu-dropdown__text--line-height: 3em;
    $menu-dropdown__text--active--font-weight: bold;
    
    $menu-dropdown__button-main-menu--padding: 0 .55em;
    $menu-dropdown__button-main-menu--height: 2.1875em;
    $menu-dropdown__button-main-menu--width: 2.1875em;
    $menu-dropdown__button-main-menu--border: $border-thin--standard $menu-dropdown__color-main;
    
    $menu-dropdown__icon-menu--margin: 0.565em 0 0 0;
    $menu-dropdown__icon-item--margin: 0.09375em 1.875em 0 0.03125em;
    
    $menu-dropdown__header--height: 5em;
    $menu-dropdown__header--padding: 0 0.75em 0 0.4em;
    $menu-dropdown__header-effect: height .3s ease-in-out;
    $menu-dropdown__header-effect-webkit: height .3s; /* Older Safari */
    $menu-dropdown__header-effect--box-shadow: $box-shadow--standard $color-shadow;
    
    $menu-dropdown__header-logo--width: 100%;
    $menu-dropdown__header-logo-container--width: 85%;
    $menu-dropdown__header-logo-container--max-width: 20.625em;
    $menu-dropdown__header-logo-container--max-height: 4.5em;
    
    $menu-dropdown__body-position: false; // Position is only false (left) or right - Using with $menu-dropdown__body--max-width
    $menu-dropdown__body--width: 100%;
    $menu-dropdown__body--min-width: false;
    $menu-dropdown__body--max-width: false;
    
    $menu-dropdown__item--padding: 0 0 0 1em;
    $menu-dropdown__item--min-height: 3.5em;
    
    $menu-dropdown__item--border-style: solid;
    $menu-dropdown__item--border-color: #d3d3d2;
    $menu-dropdown__item--border-width: 0 0 0.0625em 0;
    
    $menu-dropdown__item-button--border: $border-thin--standard $menu-dropdown__color-main;
    $menu-dropdown__item-button--margin: 0 1em 0 0;
    $menu-dropdown__item-button--height: 1.667em;
    $menu-dropdown__item-button--width: 1.667em;
    $menu-dropdown__item-button--open--border: $border-thin--standard $menu-dropdown__color-main;
    
    $menu-dropdown__footer--min-height: 5.625em;
  • URL: /components/raw/menu-mobile/menu-mobile.settings.scss
  • Filesystem Path: components/Molecules/menu-mobile/menu-mobile.settings.scss
  • Size: 2.7 KB

Molekylen “Menu mobile”

Väntande utveckling

Versionshistorik

  • 1.0.0.20200127
    • Globala variabler används.
    • Förbättring av .config.json
  • 1.0.0.20191122 Flyttat till gitrepo.