1

I want to create a drop-down, But I am not sure it is a drop-down or something else coz I am new to HTML environment.

What I want to create is

enter image description here

When I clicked on the Indian Spices, It must show another dropdown inside it, and if I clicked on the Pepper in must show another two items under it.

Here each option should comes under it is parent.And drop-down must not have the borders around it .I need to design the drop-down as same as in the image .(Without any borders)

I have tried something here but I know it is not the proper way of design. https://stackblitz.com/edit/angular-a1deda?file=app%2Fapp.component.html

Here I almost near to my goal

https://stackblitz.com/edit/angular-tjndwi?file=app%2Fapp.component.html

Can anyone guide me to solve this ...

4
  • Possible duplicate of Twitter Bootstrap Multilevel Dropdown Menu Commented Apr 27, 2018 at 5:01
  • @DragonBorn I already referred that and that's not solved my issue . Commented Apr 27, 2018 at 5:03
  • Cant you go with this Commented Apr 27, 2018 at 5:34
  • Check DragonBorn's Answer! Commented Apr 27, 2018 at 5:39

1 Answer 1

2

I think this is what you were looking for. You can do the rest bit of the designing yourself. Check the snippet.

$(document).ready(function () {
  $('#head__top').on('click', function(){
    if($('#innerCollapse').is(':visible')) {
      $('#innerCollapse').hide();
    }
  });
  $('#head__sub').on('click', function() {
     $('#innerCollapse').fadeToggle(300);
  });
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet" />

<div class="col-sm-12">
  <h4 id="head__top">
    <a class="font-weight-normal badge badge-light bg-white" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">Indian Spices</a>
    <span class="col-sm-3"></span>
    <span class="col-sm-3"></span>
    <i class="fa fa-angle-down text-fade" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample" style="font-size:18px"></i>
  </h4>
  <div class="collapse" id="collapseExample">
    <h6 id="head__sub">
    <a class="dropdown-item" role="button" aria-expanded="false"
		 aria-controls="innerCollapse">Pepper
    <span class="col-sm-3"></span>
    <span class="col-sm-3"></span>

    <i class="fa fa-angle-down" aria-hidden="true" data-toggle="collapse" href="#innerCollapse" role="button" aria-expanded="false"
		 aria-controls="innerCollapse" style="font-size:18px"></i></a>
     </h6>

  </div>

  <div class="collapse col-sm-3" id="innerCollapse">
    <h6>
      <a class="dropdown-item">Black Pepper</a>
      <a class="dropdown-item">White Pepper</a>
    </h6>
  </div>

</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>

Sign up to request clarification or add additional context in comments.

10 Comments

clicked on pepper it is not showing the other two options
@Nikson Click on the down arrow next to pepper. It will show the other two options.
If you don't mind can you please keep the down arrow in same order (match with parent)
If I closed the Indian Spices without closing of Pepper it shows the 2 options inside the pepper under the indian spices ,How to fix it @DragonBorn
Looking for your response @DragonBorn
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.