Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit521c0b2

Browse files
committed
✨ New page: Lightbox
- Slideshow 컴포넌트와 ModalBox 컴포넌트를 사용- 이미지를 클릭 시 모달에서 Slideshow가 펼쳐짐
1 parent406c7da commit521c0b2

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

‎src/pages/images/Lightbox.vue‎

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<template lang="html">
2+
<page
3+
title="Lightbox"
4+
intro="a modal image gallery (lightbox) with CSS and JavaScript"
5+
class="lightbox-page">
6+
7+
<template slot="header">
8+
<h2class="title">Lightbox (Modal Image Gallery)</h2>
9+
<p>Click on one of the images to open the lightbox:</p>
10+
</template>
11+
12+
<sample>
13+
<aclass="btn-modal"v-for="(slide, index) of slides"@click="openModal(index)">
14+
<img:src="slide.thumbnail":alt="slide.text"width="300"height="200">
15+
</a>
16+
<modal-box:is-active.sync="modal.isActive">
17+
<divclass="modal-header">
18+
<spanclass="close"@click="modal.isActive = false">&times;</span>
19+
</div>
20+
<divclass="modal-body">
21+
<slideshow:active-index.sync="slideIndex":slides="slides"is-gallery></slideshow>
22+
</div>
23+
</modal-box>
24+
</sample>
25+
26+
</page>
27+
</template>
28+
29+
<script>
30+
importSlideshowfrom'@/components/images/Slideshow.vue'
31+
importModalBoxfrom'@/components/more/ModalBox.vue'
32+
33+
exportdefault {
34+
name:'lightbox-page',
35+
data: ()=> ({
36+
modal: {
37+
isActive:false
38+
},
39+
slideIndex:0,
40+
slides: [
41+
{
42+
link:'https://www.w3schools.com/howto/img_nature_wide.jpg',
43+
thumbnail:'https://www.w3schools.com/howto/img_nature.jpg',
44+
text:'Nature and sunrise'
45+
},
46+
{
47+
link:'https://www.w3schools.com/howto/img_fjords_wide.jpg',
48+
thumbnail:'https://www.w3schools.com/howto/img_fjords.jpg',
49+
text:'Trolltunga, Norway'
50+
},
51+
{
52+
link:'https://www.w3schools.com/howto/img_mountains_wide.jpg',
53+
thumbnail:'https://www.w3schools.com/howto/img_mountains.jpg',
54+
text:'Mountains and fjords'
55+
},
56+
{
57+
link:'https://www.w3schools.com/howto/img_lights_wide.jpg',
58+
thumbnail:'https://www.w3schools.com/howto/img_lights.jpg',
59+
text:'Northern Lights'
60+
}
61+
]
62+
}),
63+
methods: {
64+
openModal(num) {
65+
this.modal.isActive=true
66+
this.slideIndex= num
67+
}
68+
},
69+
components: {
70+
Slideshow, ModalBox
71+
}
72+
}
73+
</script>
74+
75+
<style lang="scss">
76+
.lightbox-page {
77+
.sample {
78+
.btn-modal {
79+
cursor:pointer;
80+
transition:.3s;
81+
padding-right:10px;
82+
83+
&:hover {
84+
opacity:0.7;
85+
}
86+
87+
& >img {
88+
border-radius:5px;
89+
}
90+
}
91+
92+
.modal-box {
93+
background-color:rgba(0,0,0,0.9);
94+
95+
.modal-content {
96+
background-color:transparent;
97+
border:none;
98+
box-shadow:none;
99+
100+
.modal-header {
101+
background-color:inherit;
102+
text-align:right;
103+
104+
.close {
105+
font-size:35px;
106+
float:none;
107+
}
108+
}
109+
110+
.modal-body {
111+
.gallery-container {
112+
margin:auto;
113+
114+
.column {
115+
max-width:100%;
116+
}
117+
}
118+
}
119+
}
120+
}
121+
}
122+
}
123+
</style>

‎src/pages/images/index.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
exportconstSlideshow=()=>import(/* webpackChunkName: "pages/images/Slideshow" */'./Slideshow.vue')
22
exportconstSlideshowGallery=()=>import(/* webpackChunkName: "pages/images/SlideshowGallery" */'./SlideshowGallery.vue')
33
exportconstModalImages=()=>import(/* webpackChunkName: "pages/images/ModalImages" */'./ModalImages.vue')
4+
exportconstLightbox=()=>import(/* webpackChunkName: "pages/images/Lightbox" */'./Lightbox.vue')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp