-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1419.html
More file actions
664 lines (572 loc) · 20.9 KB
/
1419.html
File metadata and controls
664 lines (572 loc) · 20.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>House Renders Gallery</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #1a1a1a;
padding: 2rem;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
h1 {
text-align: center;
color: #ffffff;
margin-bottom: 0.5rem;
font-size: 2.5rem;
}
.subtitle {
text-align: center;
color: #a0a0a0;
margin-bottom: 2rem;
font-size: 1.2rem;
font-weight: 300;
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
padding: 1rem;
}
.gallery-item {
position: relative;
overflow: hidden;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer;
background-color: #262626;
}
.gallery-item:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}
.gallery-item img {
width: 100%;
height: 300px;
object-fit: cover;
display: block;
transition: transform 0.3s ease;
}
.gallery-item:hover img {
transform: scale(1.05);
}
.gallery-item::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
opacity: 0;
transition: opacity 0.3s ease;
}
.gallery-item:hover::after {
opacity: 1;
}
/* Modal styles */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(18, 18, 18, 0.95);
z-index: 1000;
padding: 0;
justify-content: center;
align-items: center;
}
.modal-content {
position: relative;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.comparison-container {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
.comparison-before,
.comparison-after {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
object-fit: contain;
display: block;
}
.comparison-after {
clip-path: inset(0 0 0 50%);
z-index: 2;
}
.comparison-before {
z-index: 1;
}
.slider {
position: absolute;
top: 50%;
left: 50%;
width: 4px;
height: 100%;
background: white;
cursor: ew-resize;
transform: translateX(-50%);
z-index: 3;
display: none;
pointer-events: none;
}
.slider::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 40px;
height: 40px;
background: white;
border-radius: 50%;
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
pointer-events: auto;
}
.slider.visible {
display: block;
}
.close-modal {
position: absolute;
top: 1rem;
right: 2rem;
color: white;
font-size: 2rem;
cursor: pointer;
z-index: 1001;
}
.download-button {
position: absolute;
top: 1.15rem;
right: 3.3rem;
width: 40px;
height: 40px;
cursor: pointer;
z-index: 1001;
background: none;
border: none;
padding: 0;
transition: transform 0.2s ease;
background-image: url('images/download.png');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
.download-button:hover {
transform: scale(1.1);
}
.download-selector {
position: absolute;
top: 1.25rem;
right: 6rem;
padding: 0.5rem;
background-color: rgba(0, 0, 0, 0.7);
color: white;
border: 1px solid rgba(255, 255, 255, 0.3);
border-radius: 4px;
z-index: 1001;
}
.download-selector select {
background-color: rgba(0, 0, 0, 0.7);
color: white;
border: none;
padding: 0.1rem;
border-radius: 4px;
cursor: pointer;
}
.download-selector select option {
background-color: #1a1a1a;
color: white;
}
.download-label {
position: absolute;
top: 0rem;
right: 5.8rem;
padding: 0.5rem;
text-align: center;
color: #a0a0a0;
font-size: 0.7rem;
font-weight: 300;
}
.modal-nav {
position: absolute;
top: 50%;
transform: translateY(-50%);
color: white;
font-size: 2rem;
cursor: pointer;
padding: 1rem;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 50%;
transition: background-color 0.3s ease;
z-index: 1002;
}
.modal-nav:hover {
background-color: rgba(0, 0, 0, 0.8);
}
.image-selector {
position: absolute;
top: 10rem;
padding: 0.5rem;
background-color: rgba(0, 0, 0, 0.7);
color: white;
border: 1px solid rgba(255, 255, 255, 0.3);
border-radius: 4px;
z-index: 1001;
}
.left-selector {
left: 2rem;
}
.right-selector {
right: 2rem;
}
.image-selector select {
background-color: rgba(0, 0, 0, 0.7);
color: white;
border: none;
padding: 0.5rem;
border-radius: 4px;
cursor: pointer;
}
.image-selector select option {
background-color: #1a1a1a;
color: white;
}
.image-selector label {
margin-right: 0.5rem;
}
.prev-image {
left: 2rem;
}
.next-image {
right: 2rem;
}
@media (max-width: 768px) {
body {
padding: 1rem;
}
h1 {
font-size: 2rem;
}
.gallery {
grid-template-columns: 1fr;
}
.modal-nav {
font-size: 1.5rem;
padding: 0.5rem;
}
.prev-image {
left: 1rem;
}
.next-image {
right: 1rem;
}
.slider::before {
width: 50px;
height: 50px;
}
}
</style>
</head>
<body>
<div class="container">
<h1>House Renders Gallery</h1>
<div class="subtitle">by Kieran Gallagher</div>
<div class="gallery">
<div class="gallery-item" onclick="openModal(1)">
<img src="images/1419/1/palette1.png" alt="View 1">
</div>
<div class="gallery-item" onclick="openModal(2)">
<img src="images/1419/2/palette1.png" alt="View 2">
</div>
<div class="gallery-item" onclick="openModal(3)">
<img src="images/1419/3/palette1.png" alt="View 3">
</div>
<div class="gallery-item" onclick="openModal(4)">
<img src="images/1419/4/palette1.png" alt="View 4">
</div>
<div class="gallery-item" onclick="openModal(5)">
<img src="images/1419/5/palette1.png" alt="View 5">
</div>
</div>
</div>
<!-- Modal -->
<div class="modal" id="imageModal">
<span class="close-modal" onclick="closeModal()">×</span>
<div class="download-label">Select Download:</div>
<button class="download-button" onclick="downloadImage()" title="Download Image"></button>
<div class="download-selector">
<select id="downloadImageSelect"></select>
</div>
<div class="image-selector left-selector">
<label for="leftImage">Left:</label>
<select id="leftImage" onchange="updateLeftImage()"></select>
</div>
<div class="image-selector right-selector">
<label for="rightImage">Right:</label>
<select id="rightImage" onchange="updateRightImage()"></select>
</div>
<span class="modal-nav prev-image" onclick="changeImage(-1)">❮</span>
<span class="modal-nav next-image" onclick="changeImage(1)">❯</span>
<div class="modal-content">
<div class="comparison-container">
<img class="comparison-before" id="beforeImage" src="" alt="Before">
<img class="comparison-after" id="afterImage" src="" alt="After">
<div class="slider" id="slider"></div>
</div>
</div>
</div>
<script>
const totalImages = 5; // Update this number when adding new image folders
const numPalettes = 2;
let currentImageIndex = 0;
const modal = document.getElementById('imageModal');
const beforeImage = document.getElementById('beforeImage');
const afterImage = document.getElementById('afterImage');
const slider = document.getElementById('slider');
const leftImageSelect = document.getElementById('leftImage');
const rightImageSelect = document.getElementById('rightImage');
const downloadImageSelect = document.getElementById('downloadImageSelect');
let isDragging = false;
function populateImageSelectors() {
// Clear existing options
leftImageSelect.innerHTML = '';
rightImageSelect.innerHTML = '';
downloadImageSelect.innerHTML = '';
// Add options for each palette
for (let i = 0; i <= numPalettes; i++) {
const optionText = i === 0 ? 'Original' : `Palette ${i}`;
const optionValue = i === 0 ? 'original.png' : `palette${i}.png`;
const leftOption = document.createElement('option');
leftOption.value = optionValue;
leftOption.textContent = optionText;
leftImageSelect.appendChild(leftOption);
const rightOption = document.createElement('option');
rightOption.value = optionValue;
rightOption.textContent = optionText;
rightImageSelect.appendChild(rightOption);
const downloadOption = document.createElement('option');
downloadOption.value = optionValue;
downloadOption.textContent = optionText;
downloadImageSelect.appendChild(downloadOption);
}
// Set default selections
leftImageSelect.value = 'original.png';
rightImageSelect.value = 'palette1.png';
downloadImageSelect.value = 'palette1.png';
}
function updateLeftImage() {
const selectedImage = leftImageSelect.value;
beforeImage.src = `images/1419/${currentImageIndex}/${selectedImage}`;
checkImagesLoaded();
}
function updateRightImage() {
const selectedImage = rightImageSelect.value;
afterImage.src = `images/1419/${currentImageIndex}/${selectedImage}`;
checkImagesLoaded();
}
function openModal(index) {
currentImageIndex = index;
modal.style.display = "flex";
modal.style.justifyContent = "center";
modal.style.alignItems = "center";
// Reset image display and slider
beforeImage.style.display = 'block';
afterImage.style.display = 'block';
slider.classList.remove('visible');
// Populate and update selectors
populateImageSelectors();
// Update images immediately with the selected values
updateImages();
}
function closeModal() {
modal.style.display = "none";
}
function updateImages() {
const leftSelectedImage = leftImageSelect.value;
const rightSelectedImage = rightImageSelect.value;
beforeImage.src = `images/1419/${currentImageIndex}/${leftSelectedImage}`;
afterImage.src = `images/1419/${currentImageIndex}/${rightSelectedImage}`;
// Hide slider until images are loaded
slider.classList.remove('visible');
// Add error handling for image loading
beforeImage.onerror = function() {
console.error(`Failed to load before image: images/1419/${currentImageIndex}/${leftSelectedImage}`);
this.style.display = 'none';
};
afterImage.onerror = function() {
console.error(`Failed to load after image: images/1419/${currentImageIndex}/${rightSelectedImage}`);
this.style.display = 'none';
};
// Add load success handlers
beforeImage.onload = function() {
console.log(`Successfully loaded before image: images/1419/${currentImageIndex}/${leftSelectedImage}`);
this.style.display = 'block';
checkImagesLoaded();
};
afterImage.onload = function() {
console.log(`Successfully loaded after image: images/1419/${currentImageIndex}/${rightSelectedImage}`);
this.style.display = 'block';
checkImagesLoaded();
};
}
function checkImagesLoaded() {
if (beforeImage.complete && afterImage.complete) {
// Both images are loaded, show slider and reset position
slider.classList.add('visible');
// Position slider to match image dimensions and position
const imageRect = beforeImage.getBoundingClientRect();
const containerRect = document.querySelector('.comparison-container').getBoundingClientRect();
const imageTop = imageRect.top - containerRect.top;
const imageHeight = imageRect.height;
const imageLeft = imageRect.left - containerRect.left;
slider.style.top = `${imageTop}px`;
slider.style.height = `${imageHeight}px`;
slider.style.left = `${imageLeft + (imageRect.width / 2)}px`;
afterImage.style.clipPath = 'inset(0 0 0 50%)';
}
}
function changeImage(direction) {
currentImageIndex = ((currentImageIndex - 1 + direction + totalImages) % totalImages) + 1;
updateImages();
}
// Slider functionality
slider.addEventListener('mousedown', handleTouchStart);
slider.addEventListener('touchstart', handleTouchStart);
document.addEventListener('mousemove', drag);
document.addEventListener('touchmove', handleTouchMove, { passive: false });
document.addEventListener('mouseup', stopDragging);
document.addEventListener('touchend', stopDragging);
function handleTouchStart(e) {
isDragging = true;
e.preventDefault();
}
function handleTouchMove(e) {
if (!isDragging) return;
e.preventDefault(); // Prevent scrolling while dragging
const touch = e.touches[0];
handleMove(touch);
}
function drag(e) {
if (!isDragging) return;
handleMove(e);
}
function handleMove(e) {
const container = document.querySelector('.comparison-container');
const imageRect = beforeImage.getBoundingClientRect();
const containerRect = container.getBoundingClientRect();
// Calculate position relative to the image
const x = e.clientX - containerRect.left;
const imageLeft = imageRect.left - containerRect.left;
const imageWidth = imageRect.width;
// Calculate percentage based on image bounds
const relativeX = x - imageLeft;
const percentage = (relativeX / imageWidth) * 100;
const clampedPercentage = Math.min(Math.max(percentage, 0), 100);
// Update both the slider position and the clip path
slider.style.left = `${imageLeft + (imageWidth * clampedPercentage / 100)}px`;
afterImage.style.clipPath = `inset(0 0 0 ${clampedPercentage}%)`;
}
function stopDragging() {
isDragging = false;
}
// Add touch support for modal navigation
let touchStartX = 0;
let touchEndX = 0;
modal.addEventListener('touchstart', function(e) {
touchStartX = e.touches[0].clientX;
}, { passive: true });
modal.addEventListener('touchend', function(e) {
touchEndX = e.changedTouches[0].clientX;
handleSwipe();
}, { passive: true });
function handleSwipe() {
const swipeThreshold = 50; // minimum distance for a swipe
const swipeDistance = touchEndX - touchStartX;
if (Math.abs(swipeDistance) > swipeThreshold) {
if (swipeDistance > 0) {
// Swiped right
changeImage(-1);
} else {
// Swiped left
changeImage(1);
}
}
}
// Close modal when clicking outside the image
modal.addEventListener('click', function(e) {
if (e.target === modal) {
closeModal();
}
});
// Keyboard navigation
document.addEventListener('keydown', function(e) {
if (modal.style.display === "flex") {
if (e.key === 'ArrowLeft') {
changeImage(-1);
} else if (e.key === 'ArrowRight') {
changeImage(1);
} else if (e.key === 'Escape') {
closeModal();
} else if (e.key === 'd') {
downloadImage();
}
}
});
function downloadImage() {
const selectedImage = downloadImageSelect.value;
const imageUrl = `images/1419/${currentImageIndex}/${selectedImage}`;
// Create a temporary link element
const link = document.createElement('a');
link.href = imageUrl;
// Set the filename and force download
const filename = `1419_view_${currentImageIndex}_${selectedImage}`;
link.download = filename;
// Append to body, click, and remove
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
// Update window resize handler to use image dimensions
window.addEventListener('resize', function() {
if (slider.classList.contains('visible')) {
const imageRect = beforeImage.getBoundingClientRect();
const containerRect = document.querySelector('.comparison-container').getBoundingClientRect();
const imageTop = imageRect.top - containerRect.top;
const imageHeight = imageRect.height;
slider.style.top = `${imageTop}px`;
slider.style.height = `${imageHeight}px`;
}
});
</script>
</body>
</html>