Dropdown Categories List help

Started by gecitli, December 08, 2020, 12:44:05 PM

Previous topic - Next topic

gecitli

Hello, how to make these codes dropdown category list

Note I need to add this to the menu in index.template?
Php
foreach ($context['categories'] as $category)
{
if (empty($category['boards']) && !$category['is_collapsed'])
continue;

echo '
<ul>
    <li><a href="#" aria-haspopup="true">categories</a>
      <ul class="dropdown" aria-label="submenu">
        <li><a href="' , $category['id'] , '">' , $category['name'] , '</a></li>
      </ul>
    </li>
  </ul>';
}


css
ul {
  background: darkorange;
  list-style: none;
  margin: 0;
  padding-left: 0;
}

li {
  color: #fff;
  background: darkorange;
  display: block;
  float: left;
  padding: 1rem;
  position: relative;
  text-decoration: none;
  transition-duration: 0.5s;
}
 
li a {
  color: #fff;
}

li:hover,
li:focus-within {
  background: red;
  cursor: pointer;
}

li:focus-within a {
  outline: none;
}

ul li ul {
  background: orange;
  visibility: hidden;
  opacity: 0;
  min-width: 5rem;
  position: absolute;
  transition: all 0.5s ease;
  margin-top: 1rem;
  left: 0;
  display: none;
}

ul li:hover > ul,
ul li:focus-within > ul,
ul li ul:hover,
ul li ul:focus {
  visibility: visible;
  opacity: 1;
  display: block
}

ul li ul li {
  clear: both;
  width: 100%;
}
http://www.webtiryaki.com
webmaster forumu
Free & Premium Responsive Themes for SMF.

Advertisement: