آموزش اضافه کردن منوی کشویی به ناوبار مانند انجمن ماورا

Collapse
X
 
  • زمان
  • نمایش
Clear All
new posts
  • Admin
    مدیر کل
    • Jul 2025
    • 906
    • 13
    • 1

    #1

    آموزش اضافه کردن منوی کشویی به ناوبار مانند انجمن ماورا


    امکانات این نسخه
    • باز و بسته شدن نرم با انیمیشن 0.25 ثانیه‌ای
    • حرکت ملایم از بالا همراه با محو شدن
    • چرخش انیمیشنی آیکون همبرگری
    • بسته شدن با کلیک بیرون از منو یا فشردن Escape
    • سازگار با موبایل و دسکتاپ
    • بدون نیاز به jQuery و فونت آیکون
    • جلوگیری از اجرای دوباره اسکریپت و تداخل رویدادها




    ابتدا به پنل مدیریت وارد بشید از قسمت: مدیریت قالب
    بخش : جستجوی الگوها
    در مقابل: جستجوی متن
    بنویسید:
    کد:
    page_header



    فقط عناوین را جستجو کنید : بله

    پیدا کنید:
    کد HTML:
    <nav id="channel-tabbar" class="h-clearfix noselect">




    در زیر آن اضافه کنید:
    کد:
    <!-- منوی کشویی ویبولتین -->
    <div id="navbar" class="navbar">
        <div class="drop-menu">
            <button type="button"
                    class="dm-title"
                    aria-label="باز و بسته کردن منو"
                    aria-expanded="false"
                    aria-controls="dm-list">
                <svg viewBox="0 0 24 24" aria-hidden="true">
                    <path d="M4 6h16M4 12h16M4 18h16"/>
                </svg>
            </button>
            <div class="dm-list" id="dm-list" aria-hidden="true" inert>
                <a class="one"
                   href="#"
                   target="_blank" rel="noopener noreferrer">
                    <svg viewBox="0 0 24 24" aria-hidden="true">
                        <path d="M12 3v12m-5-5 5 5 5-5M4 19v2h16v-2"/>
                    </svg>
                    دانلود ویبولتین
                </a>
                <a class="two"
                   href="#"
                   target="_blank" rel="noopener noreferrer">
                    <svg viewBox="0 0 24 24" aria-hidden="true">
                        <path d="M4 5h16v14H4zM8 9h8M8 13h5"/>
                    </svg>
                    فارسی ساز
                </a>
                <a class="three"
                   href="#"
                   target="_blank" rel="noopener noreferrer">
                    <svg viewBox="0 0 24 24" aria-hidden="true">
                        <path d="M12 3 4 7v5c0 5 3.5 8 8 9 4.5-1 8-4 8-9V7zM9 12l2 2 4-4"/>
                    </svg>
                    دستیار ویبولتین
                </a>
                <a class="four"
                   href="#"
                   target="_blank" rel="noopener noreferrer">
                    <svg viewBox="0 0 24 24" aria-hidden="true">
                        <path d="M4 4h16v16H4zM8 8h8M8 12h8M8 16h5"/>
                    </svg>
                    استایل‌های پارسی
                </a>
                <a class="five"
                   href="#"
                   target="_blank" rel="noopener noreferrer">
                    <svg viewBox="0 0 24 24" aria-hidden="true">
                        <path d="m12 3 2.5 5.5L20 11l-5.5 2.5L12 19l-2.5-5.5L4 11l5.5-2.5zM19 16v5m-2.5-2.5h5"/>
                    </svg>
                    استایل اختصاصی
                </a>
            </div>
        </div>
    </div>
    <style>
    #navbar .drop-menu {
        position: relative;
        float: left;
        z-index: 9999;
    }
    #navbar .dm-title {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 35px;
        height: 35px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: #cdd1dd;
        color: #667890;
        cursor: pointer;
        transition: background .25s ease, color .25s ease;
        -webkit-tap-highlight-color: transparent;
    }
    #navbar .dm-title svg {
        display: block;
        width: 21px;
        height: 21px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        transition: transform .3s ease;
    }
    #navbar .dm-title:hover,
    #navbar .dm-title.active-dmt {
        background: #667890;
        color: #fff;
    }
    #navbar .dm-title.active-dmt svg {
        transform: rotate(90deg);
    }
    #navbar .dm-list {
        display: block;
        position: absolute;
        top: 35px;
        left: 0;
        z-index: 10000;
        width: 180px;
        margin: 0;
        padding: 5px;
        box-sizing: border-box;
        background: #667890;
        border-radius: 0 0 5px 5px;
        box-shadow: 0 8px 22px rgba(0,0,0,.2);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px) scale(.98);
        transform-origin: top left;
        transition:
            opacity .25s ease,
            transform .25s ease,
            visibility .25s ease;
    }
    #navbar .dm-list.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }
    #navbar .dm-list a {
        display: flex;
        align-items: center;
        gap: 9px;
        min-height: 36px;
        margin: 3px 0;
        padding: 5px 9px;
        box-sizing: border-box;
        border-radius: 3px;
        background: rgba(0,0,0,.1);
        color: #d5ddf4;
        font-size: 13px;
        line-height: 1.8;
        text-decoration: none;
        transition: background .2s ease, color .2s ease;
    }
    #navbar .dm-list a:hover {
        background: rgba(255,255,255,.15);
        color: #fff;
    }
    #navbar .dm-list a svg {
        display: block;
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    #navbar .dm-list .one svg { color: #cbe35e; }
    #navbar .dm-list .two svg { color: #6ac0e4; }
    #navbar .dm-list .three svg { color: #e4a96a; }
    #navbar .dm-list .four svg { color: #cbe35e; }
    #navbar .dm-list .five svg { color: #e0aaf2; }
    @media (max-width: 480px) {
        #navbar .dm-list {
            width: 175px;
            max-width: calc(100vw - 20px);
        }
    }
    @media (prefers-reduced-motion: reduce) {
        #navbar .dm-list,
        #navbar .dm-title,
        #navbar .dm-title svg,
        #navbar .dm-list a {
            transition: none !important;
        }
    }
    </style>
    <script>
    (function () {
        'use strict';
        function initDropdown() {
            var navbar = document.getElementById('navbar');
            if (!navbar || navbar.dataset.dropdownInitialized === 'true') {
                return;
            }
            var button = navbar.querySelector('.dm-title');
            var menu = navbar.querySelector('.dm-list');
            if (!button || !menu) return;
            navbar.dataset.dropdownInitialized = 'true';
            var closeTimer = null;
            function openMenu() {
                if (closeTimer !== null) {
                    clearTimeout(closeTimer);
                    closeTimer = null;
                }
                menu.inert = false;
                menu.hidden = false;
                menu.setAttribute('aria-hidden', 'false');
                button.classList.add('active-dmt');
                button.setAttribute('aria-expanded', 'true');
                requestAnimationFrame(function () {
                    requestAnimationFrame(function () {
                        menu.classList.add('is-open');
                    });
                });
            }
            function closeMenu() {
                if (!menu.classList.contains('is-open') && menu.hidden) {
                    return;
                }
                if (closeTimer !== null) {
                    clearTimeout(closeTimer);
                }
                menu.classList.remove('is-open');
                menu.inert = true;
                menu.setAttribute('aria-hidden', 'true');
                button.classList.remove('active-dmt');
                button.setAttribute('aria-expanded', 'false');
                closeTimer = setTimeout(function () {
                    if (!menu.classList.contains('is-open')) {
                        menu.hidden = true;
                    }
                    closeTimer = null;
                }, 260);
            }
            button.addEventListener('click', function (event) {
                event.preventDefault();
                event.stopPropagation();
                if (menu.classList.contains('is-open')) {
                    closeMenu();
                } else {
                    openMenu();
                }
            });
            menu.addEventListener('click', function (event) {
                event.stopPropagation();
            });
            document.addEventListener('click', function (event) {
                if (!navbar.contains(event.target)) {
                    closeMenu();
                }
            });
            document.addEventListener('keydown', function (event) {
                if (event.key === 'Escape') {
                    closeMenu();
                    button.focus();
                }
            });
            menu.hidden = true;
            menu.inert = true;
            menu.classList.remove('is-open');
            menu.setAttribute('aria-hidden', 'true');
            button.classList.remove('active-dmt');
            button.setAttribute('aria-expanded', 'false');
        }
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', initDropdown);
        } else {
            initDropdown();
        }
    })();
    </script>


    ذخیره کنید.
    Copyright © coffeenetmavara, All Rights Reserved
اکانت ویژه
در حال کار...