<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport"…
- Usercode
- Assistant
body {
display: flex;
font-family: 'lucidity', Arial, sans-serif;
background-color: black;
color: white;
transform-origin: top left; /* Ensures scaling starts from top-left */
}
@font-face {
font-family: 'lucidity';
src: url('C:/Users/PC/Desktop/guest/WEB BUILD/lucidity/fonts/lucidity.ttf') format('truetype');
}
.left-half,
.right-half {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between; /* Ensures space between top content and bottom buttons */
/* Removed align-items: center to prevent vertical misalignment */
}
.left-half {
padding: 1vh 0.5vh 1vh 1vh;
/* Removed max-width: 50%; to align with reference code */
overflow-x: hidden; /* Hide overflowing content */
}
.right-half {
padding: 1vh 1vh 1vh 0.5vh;
justify-content: center;
}
.button-group {
flex-grow: 1;
overflow-y: auto;
scrollbar-width: none;
/* Optional: Hide scrollbars for a cleaner look */
}
.image-space {
width: 100%;
height: 100%;
border: 0.1vh solid white;
overflow: hidden;
box-sizing: border-box; /* Ensures padding and borders are included */
}
.image-space img {
width: 100%;
height: 100%;
object-fit: cover;
animation: fadeIn 3s forwards;
box-sizing: border-box; /* Ensures padding and borders are included */
}
.image-space video {
width: 100%;
height: 103.5%;
object-fit: cover;
animation: fadeIn 3s forwards;
box-sizing: border-box; /* Ensures padding and borders are included */
}
.dropdown-button {
background-color: black;
color: white;
border: 0.1vh solid white;
font-family: inherit;
font-size: calc(3vh * var(--scale-factor)); /* Consistent scaling */
cursor: pointer;
padding: 1.5vh 2vh;
width: 100%;
text-align: left;
opacity: 0;
animation: fadeIn 3s forwards;
transition: background-color 0.3s, color 0.3s;
margin-bottom: 1.2vh;
box-sizing: border-box; /* Includes padding in width and height */
}
.bottom-buttons-container {
display: flex;
justify-content: space-between;
align-items: center; /* Vertically centers the buttons */
padding-top: 0.9vh; /* Changed from 9px to 0.9vh for responsiveness */
padding-bottom: 0.9vh; /* Changed from 9px to 0.9vh */
margin-bottom: -0.9vh; /* Adjusted to counteract padding and maintain position */
width: 100%;
gap: 1vh; /* Ensures consistent spacing between button groups */
box-sizing: border-box; /* Includes padding in layout calculations */
}
.bottom-button:not(:last-child) {
border-right: 0.1vh solid white;
}
.bottom-button {
padding: calc(1vh * var(--scale-factor)) calc(2vh * var(--scale-factor)); /* Proportional scaling */
font-size: calc(2vh * var(--scale-factor)); /* Unified scaling with --scale-factor */
color: white;
background-color: black;
border: 0.1vh solid white;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
display: flex;
align-items: center;
justify-content: center; /* Centers content horizontally */
line-height: 1.2;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
box-sizing: border-box; /* Includes padding and border in dimensions */
}
.up-down-buttons {
display: flex;
gap: 1vh;
}
.home-chat-buttons {
display: flex;
gap: 1vh;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.dropdown-button:hover,
.bottom-button:hover {
background-color: white;
color: black;
}
.caption {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: black;
color: white;
padding: 1vh 2vh;
border-radius: 0.5vh;
font-size: calc(3vh * var(--scale-factor)); /* Consistent scaling */
z-index: 2;
display: none;
box-sizing: border-box; /* Includes padding in dimensions */
}
.caption.show {
display: block;
animation: flicker 1s linear 3;
}
@keyframes flicker {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0;
}
}
.dropdown-button:nth-child(n+2) {
animation-delay: calc((var(--delay) - 1) * 0.5s);
}
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
width: auto;
background-color: white;
color: black;
text-align: center;
border-radius: 6px;
padding: 5px 10px;
position: absolute;
z-index: 1;
bottom: 115%;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
opacity: 0;
transition: opacity 0.3s;
pointer-events: none;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
/* Accessibility: Focus styles */
.bottom-button:focus {
outline: 2px solid #fff;
outline-offset: 2px;
}
</style>
<div id="caption" class="caption"></div>
<script>
const questions = [
{ text: "Do you believe there is a higher power or force at work in the conflict between humans and machines?", link: "../questions/morpheus/morpheusdybtiahpoawitcbham.html" },
{ text: "Do you have any doubts about the prophecy or Neo's role as \"The One\"?", link: "../questions/morpheus/morpheusdyhadatorno.html" },
{ text: "Do you know about the Oracle's deal with the Merovingian to save Sati?", link: "../questions/morpheus/morpheusdykatodwts.html" },
{ text: "How did you acquire the Nebuchadnezzar?", link: "../questions/morpheus/morpheushdyatn.html" },
{ text: "How did you escape the Matrix?", link: "../questions/morpheus/morpheushdyetm.html" },
{ text: "What are your long-term goals for humanity?", link: "../questions/morpheus/morpheuswaygfh.html" },
{ text: "What are your thoughts on the Oracle's methods?", link: "../questions/morpheus/morpheuswayotom.html" },
{ text: "What did the Oracle specifically tell you about the previous five \"Ones\"?", link: "../questions/morpheus/morpheuswdtostyatpfo.html" },
{ text: "What is your personal philosophy on the nature of reality?", link: "../questions/morpheus/morpheuswiypotno.html" },
{ text: "What was the turning point for you after the fifth \"One\" died?", link: "../questions/morpheus/morpheuswttfyaftffo.html" }
];
// Sort questions alphabetically
questions.sort((a, b) => a.text.localeCompare(b.text));
function loadButtons() {
const buttonGroup = document.getElementById('button-group');
let delay = 1;
questions.forEach(question => {
const button = document.createElement('button');
button.classList.add('dropdown-button');
button.textContent = question.text;
button.style.setProperty('--delay', delay);
button.onclick = () => {
window.location.href = question.link;
};
buttonGroup.appendChild(button);
delay++;
});
}
window.addEventListener('load', loadButtons);
function loadMedia() {
const imageSpace = document.getElementById('image-space');
const video = document.createElement('video');
video.src = 'C:/Users/PC/Desktop/guest/WEB BUILD/lucidity/images/morpheus2.mp4';
video.autoplay = true;
video.muted = true;
imageSpace.appendChild(video);
video.addEventListener('ended', () => {
video.style.display = 'none';
const img = new Image();
img.src = 'C:/Users/PC/Desktop/guest/WEB BUILD/lucidity/images/morpheus2.png';
img.onload = () => {
imageSpace.appendChild(img);
};
});
}
function scrollUp() {
const buttonGroup = document.querySelector('.left-half .button-group');
const vh = window.innerHeight * 0.01;
buttonGroup.scrollTop -= 5 * vh;
}
function scrollDown() {
const buttonGroup = document.querySelector('.left-half .button-group');
const vh = window.innerHeight * 0.01;
buttonGroup.scrollTop += 5 * vh;
}
const chatButton = document.getElementById('chat-button');
const captionElement = document.getElementById('caption');
chatButton.addEventListener('click', () => {
captionElement.textContent = "This feature is not available yet";
captionElement.classList.add('show');
setTimeout(() => {
captionElement.classList.remove('show');
}, 3000);
});
function adjustLayout() {
const zoomLevel = window.devicePixelRatio;
const newScaleFactor = 1 * zoomLevel;
/* Apply the same scale factor to both main and bottom buttons */
document.documentElement.style.setProperty('--scale-factor', newScaleFactor);
}
function adjustButtonHeights() {
const buttons = document.querySelectorAll('.bottom-button');
let maxHeight = 0;
buttons.forEach(button => {
// Reset height to auto to get the natural height
button.style.height = 'auto';
if (button.offsetHeight > maxHeight) {
maxHeight = button.offsetHeight;
}
});
// Set all buttons to the maximum height
buttons.forEach(button => {
button.style.height = `${maxHeight}px`;
});
}
// Debounce function to optimize resize events
function debounce(func, wait) {
let timeout;
return function (...args) {
const later = () => {
clearTimeout(timeout);
func.apply(this, args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
window.addEventListener('resize', debounce(() => {
adjustLayout();
adjustButtonHeights();
}, 150));
// Initial adjustments on load
window.addEventListener('load', () => {
adjustLayout();
adjustButtonHeights();
});
</script>
the bottom buttons exceed their container when i zoom a lot. full html fix
To ensure that the bottom buttons do not exceed their container when zoomed in, we need to make several adjustments to the HTML, CSS, and JavaScript:
--scale-factor from becoming excessively large by setting a maximum value.Below is the revised full HTML document with these fixes implemented:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Character Viewer</title>
<style>
:root {
--scale-factor: 1;
}
html,
body {
margin: 0;
padding: 0;
height: 100vh;
overflow: hidden;
}
body {
display: flex;
font-family: 'lucidity', Arial, sans-serif;
background-color: black;
color: white;
transform-origin: top left; /* Ensures scaling starts from top-left */
transform: scale(var(--scale-factor));
}
@font-face {
font-family: 'lucidity';
src: url('C:/Users/PC/Desktop/guest/WEB BUILD/lucidity/fonts/lucidity.ttf') format('truetype');
}
.left-half,
.right-half {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between; /* Ensures space between top content and bottom buttons */
/* Removed align-items: center to prevent vertical misalignment */
}
.left-half {
padding: 1vh 0.5vh 1vh 1vh;
/* Removed max-width: 50%; to align with reference code */
overflow-x: hidden; /* Hide overflowing content */
}
.right-half {
padding: 1vh 1vh 1vh 0.5vh;
justify-content: center;
}
.button-group {
flex-grow: 1;
overflow-y: auto;
scrollbar-width: none;
/* Optional: Hide scrollbars for a cleaner look */
}
.image-space {
width: 100%;
height: 100%;
border: 0.1vh solid white;
overflow: hidden;
box-sizing: border-box; /* Ensures padding and borders are included */
position: relative;
}
.image-space img,
.image-space video {
width: 100%;
height: 100%;
object-fit: cover;
animation: fadeIn 3s forwards;
box-sizing: border-box; /* Ensures padding and borders are included */
position: absolute;
top: 0;
left: 0;
}
.dropdown-button {
background-color: black;
color: white;
border: 0.1vh solid white;
font-family: inherit;
font-size: calc(3vh * var(--scale-factor)); /* Consistent scaling */
cursor: pointer;
padding: 1.5vh 2vh;
width: 100%;
text-align: left;
opacity: 0;
animation: fadeIn 3s forwards;
transition: background-color 0.3s, color 0.3s;
margin-bottom: 1.2vh;
box-sizing: border-box; /* Includes padding in width and height */
white-space: normal;
word-wrap: break-word;
}
.bottom-buttons-container {
display: flex;
justify-content: space-between;
align-items: center; /* Vertically centers the buttons */
padding-top: 0.9vh; /* Changed from 9px to 0.9vh for responsiveness */
padding-bottom: 0.9vh; /* Changed from 9px to 0.9vh */
/* Removed negative margin to prevent overflow */
width: 100%;
gap: 1vh; /* Ensures consistent spacing between button groups */
box-sizing: border-box; /* Includes padding in layout calculations */
flex-wrap: wrap; /* Allows buttons to wrap to the next line if necessary */
}
.bottom-button:not(:last-child) {
border-right: 0.1vh solid white;
}
.bottom-button {
padding: calc(1vh * var(--scale-factor)) calc(2vh * var(--scale-factor)); /* Proportional scaling */
font-size: calc(2vh * var(--scale-factor)); /* Unified scaling with --scale-factor */
color: white;
background-color: black;
border: 0.1vh solid white;
cursor: pointer;
transition: background-color 0.3s, color 0.3s;
display: flex;
align-items: center;
justify-content: center; /* Centers content horizontally */
line-height: 1.2;
min-width: 40px; /* Set a reasonable minimum width */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
box-sizing: border-box; /* Includes padding and border in dimensions */
flex-shrink: 1; /* Allows buttons to shrink if necessary */
}
.up-down-buttons {
display: flex;
gap: 1vh;
}
.home-chat-buttons {
display: flex;
gap: 1vh;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.dropdown-button:hover,
.bottom-button:hover {
background-color: white;
color: black;
}
.caption {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: black;
color: white;
padding: 1vh 2vh;
border-radius: 0.5vh;
font-size: calc(3vh * var(--scale-factor)); /* Consistent scaling */
z-index: 2;
display: none;
box-sizing: border-box; /* Includes padding in dimensions */
}
.caption.show {
display: block;
animation: flicker 1s linear 3;
}
@keyframes flicker {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0;
}
}
.dropdown-button:nth-child(n+2) {
animation-delay: calc((var(--delay) - 1) * 0.5s);
}
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
width: auto;
background-color: white;
color: black;
text-align: center;
border-radius: 6px;
padding: 5px 10px;
position: absolute;
z-index: 1;
bottom: 115%;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
opacity: 0;
transition: opacity 0.3s;
pointer-events: none;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
/* Accessibility: Focus styles */
.bottom-button:focus {
outline: 2px solid #fff;
outline-offset: 2px;
}
/* Responsive Adjustments */
@media (max-width: 768px) {
.bottom-buttons-container {
flex-direction: column;
align-items: stretch;
}
.bottom-button {
width: 100%;
margin-bottom: 0.5vh;
border-right: none;
border-bottom: 0.1vh solid white;
}
.bottom-button:last-child {
border-bottom: none;
}
}
</style>
</head>
<body onload="loadMedia(); loadButtons(); adjustLayout(); adjustButtonHeights()">
<div class="left-half">
<div class="button-group" id="button-group"></div>
<div class="bottom-buttons-container">
<div class="tooltip">
<button class="bottom-button" onclick="window.location.href='../charselect.html'">◀</button>
<span class="tooltiptext">Back</span>
</div>
<div class="up-down-buttons">
<button class="bottom-button" onclick="scrollUp()">▲</button>
<button class="bottom-button" onclick="scrollDown()">▼</button>
</div>
<div class="home-chat-buttons">
<div class="tooltip">
<button class="bottom-button"
onclick="window.location.href='C:/Users/PC/Desktop/guest/WEB BUILD/lucidity/landing.html'">⟲</button>
<span class="tooltiptext">Main screen</span>
</div>
<div class="tooltip">
<button class="bottom-button" id="chat-button">⌨</button>
<span class="tooltiptext">Chat</span>
</div>
</div>
</div>
</div>
<div class="right-half">
<div class="image-space" id="image-space"></div>
</div>
<div id="caption" class="caption"></div>
<script>
const questions = [
{ text: "Do you believe there is a higher power or force at work in the conflict between humans and machines?", link: "../questions/morpheus/morpheusdybtiahpoawitcbham.html" },
{ text: "Do you have any doubts about the prophecy or Neo's role as \"The One\"?", link: "../questions/morpheus/morpheusdyhadatorno.html" },
{ text: "Do you know about the Oracle's deal with the Merovingian to save Sati?", link: "../questions/morpheus/morpheusdykatodwts.html" },
{ text: "How did you acquire the Nebuchadnezzar?", link: "../questions/morpheus/morpheushdyatn.html" },
{ text: "How did you escape the Matrix?", link: "../questions/morpheus/morpheushdyetm.html" },
{ text: "What are your long-term goals for humanity?", link: "../questions/morpheus/morpheuswaygfh.html" },
{ text: "What are your thoughts on the Oracle's methods?", link: "../questions/morpheus/morpheuswayotom.html" },
{ text: "What did the Oracle specifically tell you about the previous five \"Ones\"?", link: "../questions/morpheus/morpheuswdtostyatpfo.html" },
{ text: "What is your personal philosophy on the nature of reality?", link: "../questions/morpheus/morpheuswiypotno.html" },
{ text: "What was the turning point for you after the fifth \"One\" died?", link: "../questions/morpheus/morpheuswttfyaftffo.html" }
];
// Sort questions alphabetically
questions.sort((a, b) => a.text.localeCompare(b.text));
function loadButtons() {
const buttonGroup = document.getElementById('button-group');
let delay = 1;
questions.forEach(question => {
const button = document.createElement('button');
button.classList.add('dropdown-button');
button.textContent = question.text;
button.style.setProperty('--delay', delay);
button.onclick = () => {
window.location.href = question.link;
};
buttonGroup.appendChild(button);
delay++;
});
}
window.addEventListener('load', loadButtons);
function loadMedia() {
const imageSpace = document.getElementById('image-space');
const video = document.createElement('video');
video.src = 'C:/Users/PC/Desktop/guest/WEB BUILD/lucidity/images/morpheus2.mp4';
video.autoplay = true;
video.muted = true;
imageSpace.appendChild(video);
video.addEventListener('ended', () => {
video.style.display = 'none';
const img = new Image();
img.src = 'C:/Users/PC/Desktop/guest/WEB BUILD/lucidity/images/morpheus2.png';
img.onload = () => {
imageSpace.appendChild(img);
};
});
}
function scrollUp() {
const buttonGroup = document.querySelector('.left-half .button-group');
const vh = window.innerHeight * 0.01;
buttonGroup.scrollTop -= 5 * vh;
}
function scrollDown() {
const buttonGroup = document.querySelector('.left-half .button-group');
const vh = window.innerHeight * 0.01;
buttonGroup.scrollTop += 5 * vh;
}
const chatButton = document.getElementById('chat-button');
const captionElement = document.getElementById('caption');
chatButton.addEventListener('click', () => {
captionElement.textContent = "This feature is not available yet";
captionElement.classList.add('show');
setTimeout(() => {
captionElement.classList.remove('show');
}, 3000);
});
function adjustLayout() {
const zoomLevel = window.devicePixelRatio;
// Limit the scale factor to a maximum of 2 to prevent excessive scaling
const newScaleFactor = Math.min(1 * zoomLevel, 2);
/* Apply the same scale factor to both main and bottom buttons */
document.documentElement.style.setProperty('--scale-factor', newScaleFactor);
}
function adjustButtonHeights() {
const buttons = document.querySelectorAll('.bottom-button');
let maxHeight = 0;
buttons.forEach(button => {
// Reset height to auto to get the natural height
button.style.height = 'auto';
if (button.offsetHeight > maxHeight) {
maxHeight = button.offsetHeight;
}
});
// Set all buttons to the maximum height
buttons.forEach(button => {
button.style.height = `${maxHeight}px`;
});
}
// Debounce function to optimize resize events
function debounce(func, wait) {
let timeout;
return function (...args) {
const later = () => {
clearTimeout(timeout);
func.apply(this, args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
window.addEventListener('resize', debounce(() => {
adjustLayout();
adjustButtonHeights();
}, 150));
// Initial adjustments on load
window.addEventListener('load', () => {
adjustLayout();
adjustButtonHeights();
});
</script>
</body>
</html>
Limit the Scale Factor:
function adjustLayout() {
const zoomLevel = window.devicePixelRatio;
// Limit the scale factor to a maximum of 2 to prevent excessive scaling
const newScaleFactor = Math.min(1 * zoomLevel, 2);
/* Apply the same scale factor to both main and bottom buttons */
document.documentElement.style.setProperty('--scale-factor', newScaleFactor);
}
adjustLayout function now caps the --scale-factor at 2 to prevent excessive scaling that causes overflow issues.Flex Wrap in Bottom Buttons Container:
.bottom-buttons-container {
display: flex;
justify-content: space-between;
align-items: center; /* Vertically centers the buttons */
padding-top: 0.9vh; /* Changed from 9px to 0.9vh for responsiveness */
padding-bottom: 0.9vh; /* Changed from 9px to 0.9vh */
/* Removed negative margin to prevent overflow */
width: 100%;
gap: 1vh; /* Ensures consistent spacing between button groups */
box-sizing: border-box; /* Includes padding in layout calculations */
flex-wrap: wrap; /* Allows buttons to wrap to the next line if necessary */
}
flex-wrap: wrap; to allow buttons to move to the next line if there isn't enough space, preventing overflow.Allow Buttons to Shrink:
.bottom-button {
/* Existing styles */
flex-shrink: 1; /* Allows buttons to shrink if necessary */
min-width: 40px; /* Set a reasonable minimum width */
}
Relative Paths: Ensure that all media and link paths are relative or correctly mapped for deployment. Absolute paths like C:/Users/PC/... won't work on other systems or when deployed to a server.
Accessibility: Consider adding aria-labels or other accessibility features to buttons for better usability with screen readers.
Performance Optimizations: Lazy load media where possible and optimize images/videos to reduce load times.
By implementing these changes, the bottom buttons will remain within their container, even when the user zooms in significantly. The layout will also be more responsive and adaptable to different screen sizes and zoom levels.
Not yet included in a published release.
flex-shrink: 1; to let buttons shrink when there isn't enough space.min-width to prevent buttons from becoming too small.Remove Negative Margins:
margin-bottom: -0.9vh; from .bottom-buttons-container to prevent layout issues when scaling.Responsive Adjustments:
@media (max-width: 768px) {
.bottom-buttons-container {
flex-direction: column;
align-items: stretch;
}
.bottom-button {
width: 100%;
margin-bottom: 0.5vh;
border-right: none;
border-bottom: 0.1vh solid white;
}
.bottom-button:last-child {
border-bottom: none;
}
}
Image and Video Positioning:
.image-space img,
.image-space video {
position: absolute;
top: 0;
left: 0;
}
.image-space to prevent layout shifts.Enhanced Button Text Handling:
.dropdown-button {
white-space: normal;
word-wrap: break-word;
}