mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-06-07 20:08:54 +00:00
Optimized javascript code for sidebar menu
This commit is contained in:
parent
6af3ff81a1
commit
c17bf36b24
2 changed files with 13 additions and 14 deletions
|
@ -45,3 +45,15 @@
|
|||
{% endif %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
<script>
|
||||
if ((window.innerWidth || document.documentElement.clientWidth) < 980){
|
||||
/* Script for dropdown menu in sidebar */
|
||||
$(".subitem_hide").hide(); /* this hides the list initially */
|
||||
$(".dropdown-btn").click(function () {
|
||||
$(this).next(".subitem_hide").slideToggle();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -47,17 +47,4 @@
|
|||
</section>
|
||||
|
||||
{% endif %}
|
||||
</section>
|
||||
<script>
|
||||
{% if p.routable == false and p.children.count > 0 %}
|
||||
$(".subitem_hide").hide(); // this hides the list initially
|
||||
$(".dropdown-btn").click(function () {
|
||||
$(this).next(".subitem_hide").slideToggle();
|
||||
});
|
||||
{% else %}
|
||||
$(".subitem").attr("style", "display:block"); // this shows the list if it is routable
|
||||
$(".dropdown-btn").click(function () {
|
||||
$(this).next(".subitem_hide").slideToggle();
|
||||
});
|
||||
{% endif %}
|
||||
</script>
|
||||
</section>
|
Loading…
Add table
Reference in a new issue