Skip to content

Commit

Permalink
Fix : User menu not closing mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
clementp0 committed Aug 8, 2024
1 parent d42e66a commit 719d16c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
11 changes: 11 additions & 0 deletions assets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ $(() => {
$('.has-sidebar').removeClass('menu-open')
})

// User menu

$('.dropbtn').on('click', () => {
$('.dropdown-content').toggleClass('dropdown-content-open')
})
$('.dropdown-content-tray').on('click', function (e) {
if (e.target != this) return
$('.dropdown-content').removeClass('dropdown-content-open')
})


// Friend page
const friendElement = $('.add-friend.inmodal')
new UserModal(friendElement)
Expand Down
17 changes: 8 additions & 9 deletions assets/scss/components/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,15 @@
position: relative;
display: inline-block;

&:hover .dropdown-content {

display: block;
opacity: 1;
transform: translateY(0);
-webkit-transition: opacity 0.2s ease-out, transform 0.5s ease-out;
transition: opacity 0.2s ease-out, transform 0.5s ease-out;
&-content-open {
display: block!important;
opacity: 1!important;
transform: translateY(0)!important;
-webkit-transition: opacity 0.2s ease-out, transform 0.5s ease-out!important;
transition: opacity 0.2s ease-out, transform 0.5s ease-out!important;

@media (max-width: 768px) {
transform: translateY(-100%);
transform: translateY(-100%)!important;
}
}

Expand Down Expand Up @@ -147,7 +146,7 @@
box-shadow: 0px 0px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.4);

@media (max-width: 768px) {
transition: all 0.5s;
transition: all 0.5s!important;
display: block;
position: fixed;
width: 100%;
Expand Down

0 comments on commit 719d16c

Please sign in to comment.