only click collapse when navbarToggler is visible

This commit is contained in:
Sam Artioli 2021-05-06 09:26:36 -04:00
parent e0f3c5821d
commit c1fc6c994b
3 changed files with 45 additions and 55 deletions

88
dist/css/styles.css vendored
View File

@ -5,7 +5,7 @@
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-agency/blob/master/LICENSE)
*/
/*!
* Bootstrap v5.0.0 (https://getbootstrap.com/)
* Bootstrap v5.0.0-beta3 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
@ -2175,10 +2175,7 @@ progress {
.form-control[type=file] {
overflow: hidden;
}
.form-control[type=file]:not(:disabled):not(:-moz-read-only) {
cursor: pointer;
}
.form-control[type=file]:not(:disabled):not(:read-only) {
.form-control[type=file]:not(:disabled):not([readonly]) {
cursor: pointer;
}
.form-control:focus {
@ -2203,11 +2200,7 @@ progress {
color: #6c757d;
opacity: 1;
}
.form-control:-moz-read-only {
background-color: #e9ecef;
opacity: 1;
}
.form-control:disabled, .form-control:read-only {
.form-control:disabled, .form-control[readonly] {
background-color: #e9ecef;
opacity: 1;
}
@ -2231,10 +2224,7 @@ progress {
transition: none;
}
}
.form-control:hover:not(:disabled):not(:-moz-read-only)::file-selector-button {
background-color: #dde0e3;
}
.form-control:hover:not(:disabled):not(:read-only)::file-selector-button {
.form-control:hover:not(:disabled):not([readonly])::file-selector-button {
background-color: #dde0e3;
}
.form-control::-webkit-file-upload-button {
@ -2259,7 +2249,7 @@ progress {
transition: none;
}
}
.form-control:hover:not(:disabled):not(:read-only)::-webkit-file-upload-button {
.form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button {
background-color: #dde0e3;
}
@ -2332,10 +2322,7 @@ textarea.form-control-lg {
height: auto;
padding: 0.375rem;
}
.form-control-color:not(:disabled):not(:-moz-read-only) {
cursor: pointer;
}
.form-control-color:not(:disabled):not(:read-only) {
.form-control-color:not(:disabled):not([readonly]) {
cursor: pointer;
}
.form-control-color::-moz-color-swatch {
@ -2793,8 +2780,6 @@ textarea.form-control-lg {
.was-validated .form-select:valid, .form-select.is-valid {
border-color: #198754;
}
.was-validated .form-select:valid:not([multiple]):not([size]), .was-validated .form-select:valid:not([multiple])[size="1"], .form-select.is-valid:not([multiple]):not([size]), .form-select.is-valid:not([multiple])[size="1"] {
padding-right: 4.125rem;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
background-position: right 0.75rem center, center right 2.25rem;
@ -2877,8 +2862,6 @@ textarea.form-control-lg {
.was-validated .form-select:invalid, .form-select.is-invalid {
border-color: #dc3545;
}
.was-validated .form-select:invalid:not([multiple]):not([size]), .was-validated .form-select:invalid:not([multiple])[size="1"], .form-select.is-invalid:not([multiple]):not([size]), .form-select.is-invalid:not([multiple])[size="1"] {
padding-right: 4.125rem;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
background-position: right 0.75rem center, center right 2.25rem;
@ -3466,6 +3449,7 @@ textarea.form-control-lg {
.dropdown-menu {
position: absolute;
top: 100%;
z-index: 1000;
display: none;
min-width: 10rem;
@ -3481,7 +3465,6 @@ textarea.form-control-lg {
border-radius: 0.25rem;
}
.dropdown-menu[data-bs-popper] {
top: 100%;
left: 0;
margin-top: 0.125rem;
}
@ -3607,10 +3590,12 @@ textarea.form-control-lg {
margin-left: 0;
}
.dropend .dropdown-menu[data-bs-popper] {
.dropend .dropdown-menu {
top: 0;
right: auto;
left: 100%;
}
.dropend .dropdown-menu[data-bs-popper] {
margin-top: 0;
margin-left: 0.125rem;
}
@ -3631,10 +3616,12 @@ textarea.form-control-lg {
vertical-align: 0;
}
.dropstart .dropdown-menu[data-bs-popper] {
.dropstart .dropdown-menu {
top: 0;
right: 100%;
left: auto;
}
.dropstart .dropdown-menu[data-bs-popper] {
margin-top: 0;
margin-right: 0.125rem;
}
@ -3853,7 +3840,6 @@ textarea.form-control-lg {
.nav-link {
display: block;
padding: 0.5rem 1rem;
color: #ffc800;
text-decoration: none;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
@ -3862,9 +3848,6 @@ textarea.form-control-lg {
transition: none;
}
}
.nav-link:hover, .nav-link:focus {
color: #cca000;
}
.nav-link.disabled {
color: #6c757d;
pointer-events: none;
@ -4443,7 +4426,7 @@ textarea.form-control-lg {
}
.accordion-button:not(.collapsed)::after {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23e6b400'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
transform: rotate(-180deg);
transform: rotate(180deg);
}
.accordion-button::after {
flex-shrink: 0;
@ -4476,6 +4459,7 @@ textarea.form-control-lg {
}
.accordion-item {
margin-bottom: -1px;
background-color: #fff;
border: 1px solid rgba(0, 0, 0, 0.125);
}
@ -4487,10 +4471,8 @@ textarea.form-control-lg {
border-top-left-radius: calc(0.25rem - 1px);
border-top-right-radius: calc(0.25rem - 1px);
}
.accordion-item:not(:first-of-type) {
border-top: 0;
}
.accordion-item:last-of-type {
margin-bottom: 0;
border-bottom-right-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
}
@ -5302,7 +5284,7 @@ textarea.form-control-lg {
position: fixed;
top: 0;
left: 0;
z-index: 1040;
z-index: 1050;
width: 100vw;
height: 100vh;
background-color: #000;
@ -5355,6 +5337,14 @@ textarea.form-control-lg {
margin: 0.25rem;
}
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 576px) {
.modal-dialog {
max-width: 500px;
@ -5967,7 +5957,7 @@ textarea.form-control-lg {
display: inline-block;
width: 2rem;
height: 2rem;
vertical-align: -0.125em;
vertical-align: text-bottom;
border: 0.25em solid currentColor;
border-right-color: transparent;
border-radius: 50%;
@ -6004,7 +5994,7 @@ textarea.form-control-lg {
display: inline-block;
width: 2rem;
height: 2rem;
vertical-align: -0.125em;
vertical-align: text-bottom;
background-color: currentColor;
border-radius: 50%;
opacity: 0;
@ -6027,7 +6017,7 @@ textarea.form-control-lg {
.offcanvas {
position: fixed;
bottom: 0;
z-index: 1050;
z-index: 1040;
display: flex;
flex-direction: column;
max-width: 100%;
@ -6045,7 +6035,6 @@ textarea.form-control-lg {
.offcanvas-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 1rem;
}
@ -6081,16 +6070,6 @@ textarea.form-control-lg {
transform: translateX(100%);
}
.offcanvas-top {
top: 0;
right: 0;
left: 0;
height: 30vh;
max-height: 100%;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
transform: translateY(-100%);
}
.offcanvas-bottom {
right: 0;
left: 0;
@ -6104,6 +6083,17 @@ textarea.form-control-lg {
transform: none;
}
.offcanvas-backdrop::before {
position: fixed;
top: 0;
left: 0;
z-index: 1039;
width: 100vw;
height: 100vh;
content: "";
background-color: rgba(0, 0, 0, 0.5);
}
.clearfix::after {
display: block;
clear: both;

8
dist/js/scripts.js vendored
View File

@ -44,13 +44,11 @@ window.addEventListener('DOMContentLoaded', event => {
document.querySelectorAll('#navbarResponsive .nav-link')
);
responsiveNavItems.map(function (responsiveNavItem) {
console.log(responsiveNavItem);
responsiveNavItem.addEventListener('click', () => {
console.log('asd');
navbarToggler.click();
if (window.getComputedStyle(navbarToggler).display !== 'none') {
navbarToggler.click();
}
});
});
});

View File

@ -40,7 +40,9 @@ window.addEventListener('DOMContentLoaded', event => {
);
responsiveNavItems.map(function (responsiveNavItem) {
responsiveNavItem.addEventListener('click', () => {
navbarToggler.click();
if (window.getComputedStyle(navbarToggler).display !== 'none') {
navbarToggler.click();
}
});
});