Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <div class="sidenav">
  2. {% for sub_cat in sub_cats %}
  3. <button class="dropdown-btn"> {{ sub_cat.sub_cat_title }}
  4. <i class="fa fa-caret-down"></i>
  5. </button>
  6. <div class="dropdown-container">
  7. {% for subsub_cat in sub_cat.subsubcategory_set.all %}
  8. {% url 'tutorials:tutorials' subsub_cat.subsub_cat_parent.sub_cat_parent.cat_slug subsub_cat.subsub_cat_parent.sub_cat_slug subsub_cat.subsub_cat_slug as tutorial_link %}
  9.  
  10. <a href="{{ tutorial_link }}" class="{% if request.path == tutorial_link %}working{% endif %}" >{{ subsub_cat.subsub_cat_title }}</a>
  11. {% endfor %}
  12. </div>
  13. {% endfor %}
  14. </div>
  15.  
  16. var dropdown = document.getElementsByClassName("dropdown-btn");
  17. var i;
  18.  
  19. for (i = 0; i < dropdown.length; i++) {
  20. dropdown[i].addEventListener("click", function() {
  21. this.classList.toggle("active");
  22. var dropdownContent = this.nextElementSibling;
  23.  
  24. if (dropdownContent.style.display === "block") {
  25. dropdownContent.style.display = "none";
  26. } else {
  27. dropdownContent.style.display = "block";
  28. }
  29. });
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement