Ga naar: header | body | posts | reactie.| componenten | afbeeldingen
Beschrijving
How to Create a Collapsible Mobile Menu While Keeping the Parent Links Active
Learn how to use Divi’s built-in settings, along with custom CSS and JavaScript, to create a stylish collapsible mobile menu.
Add the CSS Code to the Custom CSS area
-
Go to WordPress Dashboard → Divi → Theme Options → General Tab → Custom CSS
-
Add the following CSS code:
Add the JavaScript Code to the Integration tab
-
Go to WordPress Dashboard → Divi → Theme Option → Integration tab → Header
-
Add the following JS code:
WordPress Plugin Option
If you don’t like copying and pasting a lot of code, you can download the Divi Collapsible Menu plugin from this URL.
https://github.com/eduard-un/divi-collapsible.git
-
Ga naar: header | body | posts | reactie.| componenten | afbeeldingen
Systeem aanpassen thema • Divi option > general > aangepaste css
/* Proper Collapsable Mobile Menu */
/* Style the icon's placeholder */
ul.et_mobile_menu li.menu-item-has-children .mobile-toggle,
ul.et_mobile_menu li.page_item_has_children .mobile-toggle,
.et-db #et-boc .et-l ul.et_mobile_menu li.menu-item-has-children .mobile-toggle,
.et-db #et-boc .et-l ul.et_mobile_menu li.page_item_has_children .mobile-toggle {
width: 44px;
height: 100%;
padding: 0px !important;
max-height: 44px;
position: absolute;
right: 0px;
top: 0px;
z-index: 999;
background-color: transparent;
border-bottom: 0;
text-align: center;
}
ul.et_mobile_menu > li.menu-item-has-children,
ul.et_mobile_menu > li.page_item_has_children,
ul.et_mobile_menu > li.menu-item-has-children .sub-menu li.menu-item-has-children,
.et-db #et-boc .et-l ul.et_mobile_menu > li.menu-item-has-children,
.et-db #et-boc .et-l ul.et_mobile_menu > li.page_item_has_children,
.et-db #et-boc .et-l ul.et_mobile_menu > li.menu-item-has-children .sub-menu li.menu-item-has-children {
position: relative;
}
.et_mobile_menu .menu-item-has-children > a,
.et-db #et-boc .et-l .et_mobile_menu .menu-item-has-children > a {
background-color: transparent;
}
/* Hide the Sub-menu */
ul.et_mobile_menu .menu-item-has-children .sub-menu,
#main-header ul.et_mobile_menu .menu-item-has-children .sub-menu,
.et-db #et-boc .et-l ul.et_mobile_menu .menu-item-has-children .sub-menu,
.et-db #main-header ul.et_mobile_menu .menu-item-has-children .sub-menu {
display: none !important;
visibility: hidden !important;
}
/* Show the sub-menu when the + icon is clicked */
ul.et_mobile_menu .menu-item-has-children .sub-menu.visible,
#main-header ul.et_mobile_menu .menu-item-has-children .sub-menu.visible,
.et-db #et-boc .et-l ul.et_mobile_menu .menu-item-has-children .sub-menu.visible,
.et-db #main-header ul.et_mobile_menu .menu-item-has-children .sub-menu.visible {
display: block !important;
visibility: visible !important;
}
/* Create the opening/closing icon using the SVG Icons */
ul.et_mobile_menu li.menu-item-has-children .mobile-toggle .dt-icons,
.et-db #et-boc .et-l ul.et_mobile_menu li.menu-item-has-children .mobile-toggle .dt-icons {
top: 10px;
position: relative;
}
/* Hide the closing icon if the sub-menu is not open */
ul.et_mobile_menu li.menu-item-has-children:not(.dt-open) .mobile-toggle .dt-close-icon,
.et-db #et-boc .et-l ul.et_mobile_menu li.menu-item-has-children:not(.dt-open) .mobile-toggle .dt-close-icon {
display: none;
}
/* Hide the opening icon if the sub-menu is open */
ul.et_mobile_menu li.menu-item-has-children.dt-open > .mobile-toggle .dt-open-icon,
.et-db #et-boc .et-l ul.et_mobile_menu li.menu-item-has-children.dt-open > .mobile-toggle .dt-open-icon {
display: none;
}
Divi options > integration > Voeg code toe aan de < head> van uw blog
voor collapsable menu mobile phone
<script id="dt-collapsable-menu-items">
jQuery(function ($) {
$(document).ready(function () {
$('body ul.et_mobile_menu li.menu-item-has-children, body ul.et_mobile_menu li.page_item_has_children').append(
'<span class="mobile-toggle no-smooth-scroll" aria-label="toggle sub menu"><svg class="dt-icons dt-open-icon" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><path d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32V224H48c-17.7 0-32 14.3-32 32s14.3 32 32 32H192V432c0 17.7 14.3 32 32 32s32-14.3 32-32V288H400c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z"/></svg><svg class="dt-icons dt-close-icon" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 384 512"><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg></span>',
);
$('ul.et_mobile_menu li.menu-item-has-children .mobile-toggle, ul.et_mobile_menu li.page_item_has_children .mobile-toggle').click(function (event) {
event.preventDefault();
event.stopPropagation();
$(this).parent('li').toggleClass('dt-open');
$(this)
.parent('li')
.find('ul.children')
.first()
.toggleClass('visible');
$(this)
.parent('li')
.find('ul.sub-menu')
.first()
.toggleClass('visible');
});
$('.mobile-toggle')
.on('mouseover', function () {
$(this).parent().addClass('is-hover');
})
.on('mouseout', function () {
$(this).parent().removeClass('is-hover');
});
});
});
</script>
Divi options > integration > Voeg code toe aan de < body >
sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fadsdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d 2 4 3 4w d
Divi options > integration > Voeg code bovenaan uw posts toe.
sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fadsdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d 2 4 3 4w d
Divi options > integration >
Voeg code onderaan uw posts toe, geplaatst voor de reacties
sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fadsdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d 2 4 3 4w d
Divi componenten. aangepaste cs
sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fadsdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d sdfasfa sdf sd sasdf seaasfwerw4 tryjt uh ilo ;sa fad2 4 3 4w d 2 4 3 4w d
Css in vrije vorm
voor
Hoofd elementen
Na
Ga naar: header | body | posts | reactie.| componenten | afbeeldingen | top
