Files
trpic/web/styles/preview.css
Hubert Chen 64918ef388 add noscript mode
auto set default status for sidebar
disable gestures and double-tap zoom
2026-01-16 16:53:24 +08:00

186 lines
3.4 KiB
CSS

#preview {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
display: none; /* Hidden by default */
justify-content: left;
align-items: center;
overflow: hidden;
z-index: 5;
}
#preview-view {
position: relative;
width: 100%;
height: 100vh;
}
#sidebar {
position: relative;
width: 0px;
height: 100vh;
background-color: rgba(40, 40, 40);
color: white;
justify-content: left;
transition: width .3s ease-out;
}
#sidebar-content {
padding: 4em 1.5em;
}
#sidebar-content p {
margin: 0 0 1em 0;
}
#sidebar-content span {
opacity: .8;
font-size: .8em;
}
#preview-header {
position: absolute;
z-index: 10;
top: 0;
gap: 2em;
height: 4em;
width: 100%;
color: white;
fill: white;
box-sizing: border-box;
padding: .5em;
display: flex;
justify-content: space-between;
background-image: linear-gradient(to top, transparent, hsla(0, 0%, 0%, 0.5));;
align-items: center;
}
/* Image caption and index display */
#image-info {
overflow: hidden;
text-overflow: ellipsis;
min-width: 25vw;
}
#image-info * {
height: 1.6em;
white-space: nowrap;
margin-left: .8em;
}
#image-index {
font-weight: bold;
}
#image-caption {
}
/* Styling for the index part */
#controls {
display: flex;
}
#controls span {
width: 1.6em;
height: 1.6em;
padding: .5em;
border-radius: 50%;
background: none;
color: white;
fill: currentColor;
border: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.1s ease-out;
}
#controls span:hover {
background-color: rgba(105, 105, 105, 0.5);
}
#controls svg {
width: 24px;
height: 24px;
}
/* Wrapper for the image to handle transformations */
#image-wrapper {
display: flex;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
justify-content: center;
align-items: center;
/* Default cursor */
cursor: grab;
}
/* The previewed image itself */
#preview-img {
width: 90%;
height: 90%;
object-fit: contain;
transform-origin: center center;
transition: transform 0.1s ease-out;
/* Cursor indicates the image is draggable */
cursor: grab;
/* Prevent the image from being dragged as a separate element */
pointer-events: none;
}
/* Cursor changes when dragging */
#image-wrapper:active #preview-img,
#image-wrapper.dragging #preview-img {
cursor: grabbing;
}
/* Change overlay cursor during drag for better feedback */
#image-wrapper.dragging {
cursor: grabbing;
}
/* Container for navigation buttons (prev/next) */
#nav-controls {
position: absolute;
bottom: 0;
width: 100%;
display: flex;
justify-content: space-between;
box-sizing: border-box;
z-index: 1;
pointer-events: none;
}
#nav-controls span {
width: 10vw;
height: 100vh;
font-size: 24px;
font-weight: bold;
color: grey;
background: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
-webkit-tap-highlight-color: transparent;
}
/* Hover effect for buttons */
#next-btn:hover {
background-image: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.5));
}
#prev-btn:hover {
background-image: linear-gradient(to left, transparent, rgba(0, 0, 0, 0.5));
}