Skip to content

Commit fb97414

Browse files
committed
add Kontext-Style website
1 parent 3f7c533 commit fb97414

3 files changed

Lines changed: 23 additions & 200 deletions

File tree

Kontext-Style/index.html

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ <h2 class="sidebar-title">Kontext-Style</h2>
2323
<div class="content">
2424
<div id="project-info" class="project-info">
2525
<h1>Kontext-Style</h1>
26+
<p>Kontext-Style is an open community-driven organization dedicated to artistic style transfer, LoRA adapters, and creative image generation.
27+
Here you'll find a curated collection of models, LoRAs, and datasets focused on bringing style diversity and next-level creativity to your AI image workflows.</p>
2628
<div class="links">
2729
<p><a href="https://github.com/W2GenAI-Lab/Kontext-Style" target="_blank">GitHub</a></p>
2830
<p><a href="https://huggingface.co/Kontext-Style" target="_blank">Hugging Face</a></p>
@@ -546,22 +548,6 @@ <h2>Contact Us</h2>
546548
</section>
547549
</div>
548550

549-
<!-- Modal for image enlargement -->
550-
<div id="modal" class="modal">
551-
<span class="close">&times;</span>
552-
<div class="modal-content-container">
553-
<div class="modal-content" id="modal-img"></div>
554-
</div>
555-
<div id="caption"></div>
556-
<a class="prev">&#10094;</a>
557-
<a class="next">&#10095;</a>
558-
559-
<div id="resolution" class="resolution"></div>
560-
<div class="thumbnails">
561-
<!-- Thumbnails will be generated dynamically by JavaScript -->
562-
</div>
563-
</div>
564-
565551
<script src="script.js"></script>
566552
</body>
567553
</html>

Kontext-Style/script.js

Lines changed: 1 addition & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,6 @@
11
// Kontext-Style main functionality
22
document.addEventListener('DOMContentLoaded', function() {
3-
// 模态框功能
4-
const modal = document.getElementById('modal');
5-
const modalImg = document.getElementById('modal-img');
6-
const captionText = document.getElementById('caption');
7-
const resolutionText = document.getElementById('resolution');
8-
const closeBtn = document.querySelector('.close');
9-
const prevBtn = document.querySelector('.prev');
10-
const nextBtn = document.querySelector('.next');
11-
const thumbnails = document.querySelector('.thumbnails');
12-
13-
let currentImageIndex = 0;
14-
let galleryImages = [];
15-
16-
// 收集所有图片
17-
function collectGalleryImages() {
18-
galleryImages = Array.from(document.querySelectorAll('.style-image, .overview-image'));
19-
generateThumbnails();
20-
}
21-
22-
// 生成缩略图
23-
function generateThumbnails() {
24-
thumbnails.innerHTML = '';
25-
galleryImages.forEach((img, index) => {
26-
const thumb = document.createElement('img');
27-
thumb.src = img.src;
28-
thumb.alt = img.alt;
29-
thumb.addEventListener('click', () => {
30-
currentImageIndex = index;
31-
showModal(img);
32-
});
33-
thumbnails.appendChild(thumb);
34-
});
35-
}
36-
37-
// 显示模态框
38-
function showModal(imgElement) {
39-
modal.style.display = 'block';
40-
modalImg.style.backgroundImage = `url(${imgElement.src})`;
41-
captionText.textContent = imgElement.alt;
42-
resolutionText.textContent = '';
43-
44-
// 更新缩略图状态
45-
const thumbs = thumbnails.querySelectorAll('img');
46-
thumbs.forEach((thumb, index) => {
47-
thumb.classList.toggle('thumbnail-active', index === currentImageIndex);
48-
});
49-
}
50-
51-
// 关闭模态框
52-
function closeModal() {
53-
modal.style.display = 'none';
54-
}
3+
// 移除了模态框功能,现在只保留图片导航
554

565
// 图片导航功能
576
function initImageNavigation() {
@@ -92,14 +41,6 @@ document.addEventListener('DOMContentLoaded', function() {
9241
}
9342
});
9443

95-
// 图片点击事件(模态框)
96-
images.forEach((img, index) => {
97-
img.addEventListener('click', () => {
98-
currentImageIndex = galleryImages.indexOf(img);
99-
showModal(img);
100-
});
101-
});
102-
10344
// 键盘导航
10445
display.addEventListener('keydown', (e) => {
10546
if (e.key === 'ArrowLeft' && currentIndex > 0) prevBtn.click();
@@ -111,43 +52,6 @@ document.addEventListener('DOMContentLoaded', function() {
11152
});
11253
}
11354

114-
// 事件监听
115-
document.querySelectorAll('.style-image, .overview-image').forEach(img => {
116-
img.addEventListener('click', function() {
117-
currentImageIndex = galleryImages.indexOf(this);
118-
showModal(this);
119-
});
120-
});
121-
122-
closeBtn.addEventListener('click', closeModal);
123-
124-
prevBtn.addEventListener('click', () => {
125-
currentImageIndex = (currentImageIndex - 1 + galleryImages.length) % galleryImages.length;
126-
showModal(galleryImages[currentImageIndex]);
127-
});
128-
129-
nextBtn.addEventListener('click', () => {
130-
currentImageIndex = (currentImageIndex + 1) % galleryImages.length;
131-
showModal(galleryImages[currentImageIndex]);
132-
});
133-
134-
// 点击模态框背景关闭
135-
modal.addEventListener('click', (e) => {
136-
if (e.target === modal) {
137-
closeModal();
138-
}
139-
});
140-
141-
// 键盘导航
142-
document.addEventListener('keydown', (e) => {
143-
if (modal.style.display === 'block') {
144-
if (e.key === 'Escape') closeModal();
145-
if (e.key === 'ArrowLeft') prevBtn.click();
146-
if (e.key === 'ArrowRight') nextBtn.click();
147-
}
148-
});
149-
15055
// 初始化
151-
collectGalleryImages();
15256
initImageNavigation();
15357
});

Kontext-Style/styles.css

Lines changed: 20 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -379,89 +379,6 @@ tbody tr:hover {
379379
}
380380

381381

382-
.modal {
383-
display: none;
384-
position: fixed;
385-
z-index: 1;
386-
left: 0;
387-
top: 0;
388-
width: 100%;
389-
height: 100%;
390-
overflow: hidden;
391-
background-color: rgba(0, 0, 0, 0.9);
392-
}
393-
394-
.modal-content-container {
395-
display: flex;
396-
justify-content: center;
397-
align-items: center;
398-
height: 100%;
399-
width: calc(100% - 100px); /* 留出空间给缩略图 */
400-
overflow: auto;
401-
position: relative;
402-
}
403-
404-
.modal-content {
405-
background-size: contain;
406-
background-position: center;
407-
background-repeat: no-repeat;
408-
transition: transform 0.3s ease; /* 添加平滑的缩放动画 */
409-
cursor: grab; /* 添加抓手光标 */
410-
width: auto; /* 确保初始宽度 */
411-
height: auto; /* 确保初始高度 */
412-
max-width: 100%;
413-
max-height: 100%;
414-
}
415-
416-
.modal-content:active {
417-
cursor: grabbing; /* 添加拖动光标 */
418-
}
419-
420-
.close {
421-
position: absolute;
422-
top: 15px;
423-
right: 35px;
424-
color: #fff;
425-
font-size: 40px;
426-
font-weight: bold;
427-
transition: 0.3s;
428-
}
429-
430-
.close:hover,
431-
.close:focus {
432-
color: #bbb;
433-
text-decoration: none;
434-
cursor: pointer;
435-
}
436-
437-
.thumbnails {
438-
position: fixed;
439-
top: 50%;
440-
right: 20px;
441-
display: flex;
442-
flex-direction: column;
443-
gap: 10px;
444-
max-height: 80%;
445-
overflow-y: auto;
446-
transform: translateY(-50%);
447-
z-index: 2;
448-
}
449-
450-
.thumbnails img {
451-
width: 80px;
452-
height: 80px;
453-
object-fit: cover;
454-
cursor: pointer;
455-
transition: transform 0.3s ease-in-out;
456-
}
457-
458-
.thumbnails img:hover {
459-
transform: scale(1.1);
460-
}
461-
462-
.thumbnail-active {
463-
border: 2px solid #007acc;
464-
}
465382

466383

467384
/* Overview section styles */
@@ -480,18 +397,21 @@ tbody tr:hover {
480397

481398
.overview-grid {
482399
display: grid;
483-
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
484-
gap: 15px;
400+
grid-template-columns: repeat(2, 1fr);
401+
gap: 20px;
485402
padding: 20px;
403+
max-width: 800px;
404+
margin: 0 auto;
486405
}
487406

488407
.overview-item {
489408
background-color: #ffffff;
490-
border-radius: 8px;
409+
border-radius: 12px;
491410
overflow: hidden;
492411
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
493412
transition: transform 0.3s ease;
494-
height: 150px;
413+
aspect-ratio: 1;
414+
position: relative;
495415
}
496416

497417
.overview-item:hover {
@@ -504,6 +424,19 @@ tbody tr:hover {
504424
height: 100%;
505425
object-fit: cover;
506426
display: block;
427+
transition: transform 0.3s ease;
428+
}
429+
430+
.overview-item:hover .overview-image {
431+
transform: scale(1.05);
432+
}
433+
434+
@media (max-width: 768px) {
435+
.overview-grid {
436+
grid-template-columns: 1fr;
437+
gap: 15px;
438+
padding: 15px;
439+
}
507440
}
508441

509442
/* Individual styles section */

0 commit comments

Comments
 (0)