Skip to content

Commit

Permalink
sidebar wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
CherrelleTucker committed Jan 6, 2025
1 parent adb0e04 commit 1e8d965
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
{% if site.data.contact.size > 0 %}
<span class="icon-border"></span>
{% endif %}
{% endunless %}

{% endunless %}
{% for entry in site.data.contact %}
{% case entry.type %}
{% when 'github', 'twitter' %}
Expand All @@ -75,7 +74,6 @@
{% else %}
{% assign url = entry.url %}
{% endcase %}

{% if url %}
<a
href="{{ url }}"
Expand Down Expand Up @@ -104,39 +102,41 @@
</aside>
<!-- #sidebar -->

<!-- Collapsible Menu CSS -->
<style>
/* Hide submenus by default */
.submenu {
display: none;
list-style: none;
margin: 0;
padding-left: 15px;
}

/* Show submenu when the parent menu item is active or toggled */
.menu-item.open > .submenu {
display: block;
}

/* Styling for submenu items */
.submenu-item a {
font-size: 0.9rem;
color: #555;
}
</style>
<!-- Collapsible Menu CSS -->
<style>
/* Hide submenus by default */
#sidebar .submenu {
display: none;
list-style: none;
margin: 0;
padding-left: 15px;
}

#sidebar .menu-item.open > .submenu {
display: block;
}

#sidebar .submenu-item a {
font-size: 0.9rem;
color: #555;
}
</style>

<!-- Collapsible Menu JavaScript -->
<script>
document.querySelectorAll('.menu-item > a').forEach(link => {
link.addEventListener('click', function (e) {
const parent = this.parentElement;
const submenu = parent.querySelector('.submenu');
if (submenu) {
e.preventDefault();
parent.classList.toggle('open');
}
});
<!-- Collapsible Menu JavaScript -->
<script>
document.querySelectorAll('#sidebar .menu-item > a').forEach(link => {
link.replaceWith(link.cloneNode(true));
});

document.querySelectorAll('#sidebar .menu-item > a').forEach(link => {
link.addEventListener('click', function (e) {
const parent = this.parentElement;
const submenu = parent.querySelector('.submenu');
if (submenu) {
e.preventDefault();
parent.classList.toggle('open');
}
});
</script>
});
</script>

0 comments on commit 1e8d965

Please sign in to comment.