Updated Right Nav And Added Click-Away Closing

Rewrote the nav HTML/CSS

.nav --> #right-nav-panel
.nav-toggle <label> --> removed, using #nav-toggle:after for styling instead

The main purpose of this rewrite was to allow for a function such that the nav panel will auto-close when the user clicks away from it. The former structure of using a label for a hidden checkbox made this impossible, as the label produced two clicks when clicked on (one for the label, and one for the box), therefore locking the panel if the click-away feature was turned on.

I will add in a 'pin' toggle soon to allow users to hold the nav panel open if they wish.

- Changed default font size from 1rem to 15px;

- removed unused CSS code for <main>,<article>,<header>, and <footer>, which were not used in the HTML
This commit is contained in:
RossAsscends
2023-03-01 04:22:32 +09:00
parent d9a7a74116
commit fdc0665987
2 changed files with 107 additions and 292 deletions

View File

@@ -1887,23 +1887,43 @@
} }
}); });
$( "body" ).click(function() { // this makes the input bar's option menu disappear when clicked away from
$(document).on('click', function(event) { // this makes the input bar's option menu disappear when clicked away from
if($("#options").css('opacity') == 1.0){ if($("#options").css('opacity') == 1.0){
$('#options').transition({ $('#options').transition({
opacity: 0.0, opacity: 0.0,
duration: 100,//animation_rm_duration, duration: 100,//animation_rm_duration,
easing: animation_rm_easing, easing: animation_rm_easing,
complete: function() { complete: function() {
$("#options").css('display', 'none'); $("#options").css('display', 'none');
} }
}); })
}
}); }
$( "#options_button" ).click(function() { });
// RossAscends: Added functionality that will close the RightNav panels when User clicks outside them
var NavToggle = document.getElementById("nav-toggle");
$('document').ready(function(){
$("html").click(function(e){
if (NavToggle.checked === true){
if ($(e.target).attr('id') !== "nav-toggle") {
if (document.querySelector('#right-nav-panel').contains(e.target) === false){
document.getElementById('nav-toggle').click();
}
}
};
});
});
//-------------------------------------------------------------------------------------------------------------
$( "#options_button" ).click(function() { // this is the options button click function, shows the options menu if closed
if($("#options").css('display') === 'none' && $("#options").css('opacity') == 0.0){ if($("#options").css('display') === 'none' && $("#options").css('opacity') == 0.0){
$("#options").css('display', 'block'); $("#options").css('display', 'block');
$('#options').transition({ $('#options').transition({
opacity: 1.0, opacity: 1.0, // the manual setting of CSS via JS is what allows the click-away feature to work
duration: 100, duration: 100,
easing: animation_rm_easing, easing: animation_rm_easing,
complete: function() { complete: function() {
@@ -1939,35 +1959,6 @@
} }
}); });
//-----------------------------------------------
// Now let's add functionality that will close the BG menu and/or RightNav panels when User clicks outside them
// COULDN'T GET THIS TO WORK BUT CODE LEFT FOR FUTURE REFERENCE
// general function to deetct which elements are being clicked on.
//$('body').on('click', function(e){
// alert( 'Class is '+ $(e.target).attr('class') + '. ID is '+ $(e.target).attr('id'));
//});
//general function to watch the status of the nav-toggle checkbox
//var checkb = document.getElementById("nav-toggle");
//checkb.addEventListener('change', function(e) {
// alert(checkb.checked, checkb.value);
//});
//$('document').ready(function(){
// $("body").click(function(e){
// if (e.target.parentNode.classList.contains('.nav') == false){
// alert('triggered!');
// document.getElementById('nav-toggle').click();
// };
//});
//});
//---------------------------------------------------
$( "#option_regenerate" ).click(function() { $( "#option_regenerate" ).click(function() {
if(is_send_press == false){ if(is_send_press == false){
is_send_press = true; is_send_press = true;
@@ -2964,11 +2955,9 @@
</div> </div>
</div> </div>
<input type="checkbox" id="nav-toggle" hidden> <input type="checkbox" id="nav-toggle">
<nav class="nav">
<label for="nav-toggle" class="nav-toggle" onclick></label>
<nav id="right-nav-panel">
<div class="right_menu_button" id="rm_button_characters"><h2>Characters</h2></div> <div class="right_menu_button" id="rm_button_characters"><h2>Characters</h2></div>
<div class="right_menu_button" id="rm_button_settings"><h2>Settings</h2></div> <div class="right_menu_button" id="rm_button_settings"><h2>Settings</h2></div>

View File

@@ -23,7 +23,7 @@ body {
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: gray #191b31; scrollbar-color: gray #191b31;
font-family: "Noto Sans", "Noto Color Emoji", sans-serif; /*add in custom font universally */ font-family: "Noto Sans", "Noto Color Emoji", sans-serif; /*add in custom font universally */
font-size:1rem; font-size:15px; /*1rem*/
color: rgb(229, 224, 216); color: rgb(229, 224, 216);
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
} }
@@ -274,7 +274,7 @@ code {
padding: 0px; padding: 0px;
border-top: 1px solid #ffffff11; border-top: 1px solid #ffffff11;
} }
.nav hr{ #right-nav-panel hr{
background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0)); background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
} }
.options-content a { .options-content a {
@@ -1220,11 +1220,16 @@ width: 103px;
} }
/* STLYES FOR THE CHAT MESSAGE DELETION CHECKBOXES */
/* --------------------------------------------------------------------------------------*/
/* checkboxes default to being hidden unless called by the delete mesasges option menu button, which uses JS to force them to be display:block*/
.del_checkbox{ .del_checkbox{
display: none; display: none;
opacity: 0.7; opacity: 0.7;
} }
/*this hides the replacement for input form until Delete Messages mode is called*/
#dialogue_del_mes{ #dialogue_del_mes{
display: none; display: none;
} }
@@ -1232,8 +1237,7 @@ width: 103px;
display: block; display: block;
} }
input[type='checkbox'] :not(#nav-toggle){
input[type='checkbox'] {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
appearance: none; appearance: none;
@@ -1250,7 +1254,8 @@ input[type='checkbox'] {
right: 5px; /*and centers it in the checkbox column*/ right: 5px; /*and centers it in the checkbox column*/
} }
input[type='checkbox']::before { /* the checkbox starts with a size 0 background of a checkmark */
input[type='checkbox']::before :not(#nav-toggle) {
content: ''; content: '';
color: #fff; color: #fff;
position: absolute; position: absolute;
@@ -1272,10 +1277,12 @@ input[type='checkbox']::before {
background-image: url("data:image/svg+xml;base64,PCEtLSBHZW5lcmF0ZWQgYnkgSWNvTW9vbi5pbyAtLT4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjQ0OCIgaGVpZ2h0PSI0NDgiIHZpZXdCb3g9IjAgMCA0NDggNDQ4Ij4KPHRpdGxlPjwvdGl0bGU+Cj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box']:checked::before { /* when the checkbox is checked, the background image is grown to normal size to fill the background of the 'checkbox'*/
input[type='checkbox']:checked::before :not(#nav-toggle) {
-webkit-transform: scale(1); -webkit-transform: scale(1);
transform: scale(1); transform: scale(1);
} }
/*---------------------------------------------------------------------------------------------------------*/
select { select {
color: rgba(255,255,255,0.7); color: rgba(255,255,255,0.7);
@@ -1287,8 +1294,6 @@ select {
font-size: 15px; font-size: 15px;
border: 1px solid rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,0.5);
border-radius:10px; border-radius:10px;
margin-top: 5px; margin-top: 5px;
margin-bottom: 45px; margin-bottom: 45px;
} }
@@ -1303,10 +1308,8 @@ select {
border-radius:10px; border-radius:10px;
background-color: rgba(0,0,0,0.3); background-color: rgba(0,0,0,0.3);
box-shadow:none; box-shadow:none;
} }
.option_select_right_menu{ .option_select_right_menu{
width:284px; width:284px;
margin-left: 10px; margin-left: 10px;
@@ -1369,7 +1372,6 @@ input[type="range"] {
height: 7px; height: 7px;
background: rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.6);
border-radius: 15px; border-radius: 15px;
/* background-image: linear-gradient(#ff4500, #ff4500); */
background-size: 70% 100%; background-size: 70% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
@@ -1377,16 +1379,16 @@ input[type="range"] {
opacity: 0.85; opacity: 0.85;
} }
.nav h5 a{ #right-nav-panel h5 a{
color: #936f4a; color: #936f4a;
} }
.nav h5 a:hover{ #right-nav-panel h5 a:hover{
color: #998e6b; color: #998e6b;
} }
.nav h4 a{ #right-nav-panel h4 a{
color: #936f4a; color: #936f4a;
} }
.nav h4 a:hover{ #right-nav-panel h4 a:hover{
color: #998e6b; color: #998e6b;
} }
@@ -1424,13 +1426,12 @@ input[type="range"] {
color: rgba(255,255,255,0.3); color: rgba(255,255,255,0.3);
cursor:pointer; cursor:pointer;
margin-right: 4px; margin-right: 4px;
/*opacity:0.07;*/
transition: 0.3s ease-in-out; transition: 0.3s ease-in-out;
height:20px; height:20px;
width:20px; width:20px;
} }
.mes_edit:after {content: "\270e";} .mes_edit:after {content: "\270e";} /*unicode pencil*/
.mes_edit:hover{color:white;} .mes_edit:hover{color:white;}
@@ -1450,7 +1451,6 @@ input[type="range"] {
.mes_edit_cancel{ .mes_edit_cancel{
display: none; display: none;
float:right; float:right;
/* right:8px; */
margin-right: 4px; margin-right: 4px;
cursor:pointer; cursor:pointer;
opacity:0.5; opacity:0.5;
@@ -1464,7 +1464,6 @@ input[type="range"] {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
border: none; border: none;
/* border-radius: 15px;*/
border-color: transparent; border-color: transparent;
outline: none; outline: none;
box-shadow: 0 0 3px rgba(255,255,255,0.5); box-shadow: 0 0 3px rgba(255,255,255,0.5);
@@ -1504,7 +1503,7 @@ label.checkbox :checked + span {
margin: 0px; margin: 0px;
} }
label.checkbox :checked + span:after { label.checkbox :checked + span:after {
content: '\2714'; content: '\2714'; /*unicode 'heavy checkmark'*/
font-size: 18px; font-size: 18px;
position: absolute; position: absolute;
top: -3px; top: -3px;
@@ -1527,8 +1526,6 @@ label.checkbox :checked + span:after {
grid-template-columns: auto auto; grid-template-columns: auto auto;
} }
#shadow_character_popup{ #shadow_character_popup{
backdrop-filter: blur(10px) brightness(0.3); backdrop-filter: blur(10px) brightness(0.3);
-webkit-backdrop-filter: blur(10px) brightness(0.3); -webkit-backdrop-filter: blur(10px) brightness(0.3);
@@ -1693,8 +1690,6 @@ label.checkbox :checked + span:after {
margin-left: 5px; margin-left: 5px;
margin-top: 30px; margin-top: 30px;
scrollbar-width: thin; scrollbar-width: thin;
/* width: 900px; */
/* height: 80%; */
overflow: hidden; overflow: hidden;
overflow-y: scroll; overflow-y: scroll;
max-width:430px; max-width:430px;
@@ -1742,11 +1737,6 @@ label.checkbox :checked + span:after {
width:30px; width:30px;
} }
#advanced_div{ #advanced_div{
font-size: 1rem; font-size: 1rem;
background-repeat: no-repeat; background-repeat: no-repeat;
@@ -1762,7 +1752,6 @@ label.checkbox :checked + span:after {
border-radius: 3px; border-radius: 3px;
background-color: rgba(0,0,0,0.3); background-color: rgba(0,0,0,0.3);
opacity: 0.7; opacity: 0.7;
/*font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;*/
} }
#advanced_book_logo{ #advanced_book_logo{
width: 35px; width: 35px;
@@ -1803,42 +1792,6 @@ body {
height: 100%; height: 100%;
} }
/*body {
color: rgb(229, 224, 216);
font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
background-color: #f1f1f1;
}*/
main {
max-width: 1024px;
margin: 0 auto
}
article {
margin: 0 1em;
padding: 0 22px;
-webkit-transition: -webkit-transform .3s;
-moz-transition: : -moz-transform .3s;
transition: transform .3s;
}
header {
margin: 0;
padding: 0;
text-align: center;
}
footer {
font-size: 14px;
text-align: center
}
p { p {
margin-bottom: 16px; margin-bottom: 16px;
margin-top:0; margin-top:0;
@@ -1866,7 +1819,6 @@ h1 {
} }
h2 { h2 {
font-size: 1.5rem; font-size: 1.5rem;
line-height: 1.75rem; line-height: 1.75rem;
margin-top: 5px; margin-top: 5px;
@@ -1889,7 +1841,7 @@ a {
margin: 6px; margin: 6px;
white-space: normal!important; white-space: normal!important;
word-wrap: break-word; word-wrap: break-word;
display: inline-block; display: inline-block;
line-height: 1.25; line-height: 1.25;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
@@ -1901,7 +1853,6 @@ a {
padding: .5rem 1rem; padding: .5rem 1rem;
font-size: 1rem; font-size: 1rem;
font-weight: 400; font-weight: 400;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12); box-shadow: 0 2px 5px 0 rgba(0,0,0,.16),0 2px 10px 0 rgba(0,0,0,.12);
} }
.btn { .btn {
@@ -1924,13 +1875,12 @@ a {
background-color: transparent; background-color: transparent;
} }
/* Right nav panel */
/* default position is 450px to the right, off screen*/
/* it is position:fixed, so it's never affected by the location/size of any other element */
#right-nav-panel{
/* Right nav */
.nav {
width: 450px; width: 450px;
/*min-width: 450px;*/
height: 100%; height: 100%;
position: fixed; position: fixed;
top: 0; top: 0;
@@ -1949,62 +1899,60 @@ a {
border-left: 1px solid rgba(0,0,0,0.3); border-left: 1px solid rgba(0,0,0,0.3);
} }
.nav-toggle { /* this is the class of the visible LABEL for the hidden #nav-toggle div checkbox*/
border-radius: 5px; /* it is displaced 455px to the left of the #right-nav-paneldiv, this keeps it on screen while the #right-nav-panel is held off screen to the right */
#nav-toggle {
position: absolute; position: absolute;
right: 455px; right: 13px;
top: 5px; top: 12px;
padding: 5px; padding: 0px;
backdrop-filter: blur(10px) brightness(0.3); margin: 0px;
-webkit-backdrop-filter: blur(10px) brightness(0.3);
border: 1px solid rgba(255,255,255,0.5);
color: rgba(255,255,255,0.5);
cursor: pointer; cursor: pointer;
font-size: 1.25rem; height: 15px;
line-height: 1rem; width: 15px;
height:30px; z-index: 3001;
z-index: 2001;
-webkit-transition: color .25s ease-in-out;
-moz-transition: color .25s ease-in-out;
transition: color .25s ease-in-out;
} }
.nav-toggle:after { #nav-toggle:hover::after {
content: '\2630';
text-decoration: none;
}
.nav-toggle:hover {
color: #f4f4f4; color: #f4f4f4;
} }
[id='nav-toggle'] { #nav-toggle::after {
position: absolute; content: '\2630';
display: none; line-height: 30px;
font-size: 2em;
padding: 0;
text-align: center;
vertical-align: middle;
display: inline-block;
width: 30px;
height: 30px;
margin-top: -8px;
margin-left: -9px;
border: 1px solid #666;
border-radius: 5px;
background: rgba(0, 0, 0, 1);
color: #666;
-webkit-transition: all 0.275s;
transition: all 0.275s;
} }
[id='nav-toggle']:checked ~ .nav > .nav-toggle { #nav-toggle:checked::after {
left: auto;
right: 5px;
top: 5px;
}
[id='nav-toggle']:checked ~ .nav {
right: 0;
box-shadow: -5px 0px 10px 0px rgba(0, 0, 0, 0.50);
overflow-y: auto;
}
[id='nav-toggle']:checked ~ main > article {
-webkit-transform: translateX(-450px);
-moz-transform: translateX(-450px);
transform: translateX(-450px);
}
[id='nav-toggle']:checked ~ .nav > .nav-toggle:after {
content: '\2715'; content: '\2715';
line-height: 30px;
font-size: 2em;
}
/* this affects the #right-nav-panel div ONLY WHEN the nav-toggle checkbox is checked*/
/* the #right-nav-panel is moved to the right edge of the screen*/
/* this is what causes the panel movement */
#nav-toggle:checked ~ #right-nav-panel{
right: 0px;
box-shadow: -5px 0px 10px 0px rgba(0, 0, 0, 0.50);
overflow-y: auto;
} }
body { body {
@@ -2038,130 +1986,8 @@ body {
} }
#sheld {} #right-nav-panel{
.nav {
width: 100%; width: 100%;
box-shadow: none box-shadow: none
} }
} }
.nav > ul {
display: block;
margin: 0;
padding: 0;
list-style: none;
}
.nav > ul > li {
line-height: 2.5;
opacity: 0;
-webkit-transform: translateX(50%);
-moz-transform: translateX(50%);
-ms-transform: translateX(50%);
transform: translateX(50%);
-webkit-transition: opacity .5s .1s, -webkit-transform .5s .1s;
-moz-transition: opacity .5s .1s, -moz-transform .5s .1s;
-ms-transition: opacity .5s .1s, -ms-transform .5s .1s;
transition: opacity .5s .1s, transform .5s .1s;
}
[id='nav-toggle']:checked ~ .nav > ul > li {
opacity: 1;
-webkit-transform: translateX(0);
-moz-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0);
}
.nav > ul > li:nth-child(2) {
-webkit-transition: opacity .5s .2s, -webkit-transform .5s .2s;
transition: opacity .5s .2s, transform .5s .2s;
}
.nav > ul > li:nth-child(3) {
-webkit-transition: opacity .5s .3s, -webkit-transform .5s .3s;
transition: opacity .5s .3s, transform .5s .3s;
}
.nav > ul > li:nth-child(4) {
-webkit-transition: opacity .5s .4s, -webkit-transform .5s .4s;
transition: opacity .5s .4s, transform .5s .4s;
}
.nav > ul > li:nth-child(5) {
-webkit-transition: opacity .5s .5s, -webkit-transform .5s .5s;
transition: opacity .5s .5s, transform .5s .5s;
}
.nav > ul > li:nth-child(6) {
-webkit-transition: opacity .5s .6s, -webkit-transform .5s .6s;
transition: opacity .5s .6s, transform .5s .6s;
}
.nav > ul > li:nth-child(7) {
-webkit-transition: opacity .5s .7s, -webkit-transform .5s .7s;
transition: opacity .5s .7s, transform .5s .7s;
}
.nav > ul > li > a {
display: inline-block;
position: relative;
padding: 0;
font-family: 'Open Sans', sans-serif;
font-weight: 300;
font-size: 1.2em;
color: #dadada;
width: 100%;
text-decoration: none;
-webkit-transition: color .5s ease, padding .5s ease;
-moz-transition: color .5s ease, padding .5s ease;
transition: color .5s ease, padding .5s ease;
}
.nav > ul > li > a:hover,
.nav > ul > li > a:focus {
color: white;
padding-left: 15px;
}
.nav > ul > li > a:before {
content: '';
display: block;
position: absolute;
right: 0;
bottom: 0;
height: 1px;
width: 100%;
-webkit-transition: width 0s ease;
transition: width 0s ease;
}
.nav > ul > li > a:after {
content: '';
display: block;
position: absolute;
left: 0;
bottom: 0;
height: 1px;
width: 100%;
background: #3bc1a0;
-webkit-transition: width .5s ease;
transition: width .5s ease;
}
.nav > ul > li > a:hover:before {
width: 0%;
background: #3bc1a0;
-webkit-transition: width .5s ease;
transition: width .5s ease;
}
.nav > ul > li > a:hover:after {
width: 0%;
background: transparent;
-webkit-transition: width 0s ease;
transition: width 0s ease;
}