Selecteer een pagina

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
Add the JavaScript Code to the Integration tab
WordPress Plugin Option

 

 

Add the CSS Code to the Custom CSS area

  1. Go to WordPress DashboardDivi → Theme Options → General Tab → Custom CSS

  2. Add the following CSS code:

    Add the JavaScript Code to the Integration tab

    1. Go to WordPress DashboardDivi → Theme Option → Integration tab → Header

    2. 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

 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 < 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

Afbeeldingen

Voorbeeld van Elegant Themes