2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Advanced Galleria implementation with a custom UI.</p>
|
|
|
|
</DocSectionText>
|
2023-10-04 09:32:01 +00:00
|
|
|
<div class="card">
|
2023-02-28 08:29:30 +00:00
|
|
|
<Galleria
|
|
|
|
ref="galleria"
|
|
|
|
v-model:activeIndex="activeIndex"
|
|
|
|
:value="images"
|
|
|
|
:numVisible="5"
|
|
|
|
containerStyle="max-width: 640px"
|
|
|
|
:containerClass="galleriaClass"
|
|
|
|
:showThumbnails="showThumbnails"
|
|
|
|
:showItemNavigators="true"
|
|
|
|
:showItemNavigatorsOnHover="true"
|
|
|
|
:circular="true"
|
2023-04-03 23:25:13 +00:00
|
|
|
:autoPlay="isAutoPlay"
|
2023-02-28 08:29:30 +00:00
|
|
|
:transitionInterval="3000"
|
|
|
|
>
|
|
|
|
<template #item="slotProps">
|
|
|
|
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" :style="[{ width: !fullScreen ? '100%' : '', display: !fullScreen ? 'block' : '' }]" />
|
|
|
|
</template>
|
|
|
|
<template #thumbnail="slotProps">
|
|
|
|
<div class="grid grid-nogutter justify-content-center">
|
|
|
|
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #footer>
|
|
|
|
<div class="custom-galleria-footer">
|
|
|
|
<Button icon="pi pi-list" @click="onThumbnailButtonClick" />
|
2023-03-28 14:00:36 +00:00
|
|
|
<Button :icon="slideButtonIcon" @click="toggleAutoSlide" />
|
2023-02-28 08:29:30 +00:00
|
|
|
<span v-if="images" class="title-container">
|
|
|
|
<span>{{ activeIndex + 1 }}/{{ images.length }}</span>
|
|
|
|
<span class="title">{{ images[activeIndex].title }}</span>
|
|
|
|
<span>{{ images[activeIndex].alt }}</span>
|
|
|
|
</span>
|
|
|
|
<Button :icon="fullScreenIcon" @click="toggleFullScreen" class="fullscreen-button" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Galleria>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" :service="['PhotoService']" :dependencies="{ sass: '1.45.0', 'sass-loader': '8.0.2' }" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { PhotoService } from '@/service/PhotoService';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
images: null,
|
|
|
|
activeIndex: 0,
|
|
|
|
showThumbnails: false,
|
|
|
|
isAutoPlayActive: true,
|
|
|
|
fullScreen: false,
|
2023-04-03 23:25:13 +00:00
|
|
|
isAutoPlay: true,
|
2023-02-28 08:29:30 +00:00
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
<Galleria ref="galleria" v-model:activeIndex="activeIndex" :value="images" :numVisible="5" containerStyle="max-width: 640px" :containerClass="galleriaClass"
|
2023-04-03 23:25:13 +00:00
|
|
|
:showThumbnails="showThumbnails" :showItemNavigators="true" :showItemNavigatorsOnHover="true" :circular="true" :autoPlay="isAutoPlay" :transitionInterval="3000">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #item="slotProps">
|
|
|
|
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" :style="[{ width: !fullScreen ? '100%' : '', display: !fullScreen ? 'block' : '' }]" />
|
|
|
|
</template>
|
|
|
|
<template #thumbnail="slotProps">
|
|
|
|
<div class="grid grid-nogutter justify-content-center">
|
|
|
|
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #footer>
|
|
|
|
<div class="custom-galleria-footer">
|
|
|
|
<Button icon="pi pi-list" @click="onThumbnailButtonClick" />
|
2023-03-28 14:00:36 +00:00
|
|
|
<Button :icon="slideButtonIcon" @click="toggleAutoSlide" />
|
2023-02-28 08:29:30 +00:00
|
|
|
<span v-if="images" class="title-container">
|
|
|
|
<span>{{ activeIndex + 1 }}/{{ images.length }}</span>
|
|
|
|
<span class="title">{{ images[activeIndex].title }}</span>
|
|
|
|
<span>{{ images[activeIndex].alt }}</span>
|
|
|
|
</span>
|
|
|
|
<Button :icon="fullScreenIcon" @click="toggleFullScreen" class="fullscreen-button" />
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-10-15 09:38:39 +00:00
|
|
|
</Galleria>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-10-04 09:32:01 +00:00
|
|
|
<div class="card">
|
2023-02-28 08:29:30 +00:00
|
|
|
<Galleria ref="galleria" v-model:activeIndex="activeIndex" :value="images" :numVisible="5" containerStyle="max-width: 640px" :containerClass="galleriaClass"
|
2023-04-03 23:25:13 +00:00
|
|
|
:showThumbnails="showThumbnails" :showItemNavigators="true" :showItemNavigatorsOnHover="true" :circular="true" :autoPlay="isAutoPlay" :transitionInterval="3000">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #item="slotProps">
|
|
|
|
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" :style="[{ width: !fullScreen ? '100%' : '', display: !fullScreen ? 'block' : '' }]" />
|
|
|
|
</template>
|
|
|
|
<template #thumbnail="slotProps">
|
|
|
|
<div class="grid grid-nogutter justify-content-center">
|
|
|
|
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #footer>
|
|
|
|
<div class="custom-galleria-footer">
|
|
|
|
<Button icon="pi pi-list" @click="onThumbnailButtonClick" />
|
2023-03-28 14:00:36 +00:00
|
|
|
<Button :icon="slideButtonIcon" @click="toggleAutoSlide" />
|
2023-02-28 08:29:30 +00:00
|
|
|
<span v-if="images" class="title-container">
|
|
|
|
<span>{{ activeIndex + 1 }}/{{ images.length }}</span>
|
|
|
|
<span class="title">{{ images[activeIndex].title }}</span>
|
|
|
|
<span>{{ images[activeIndex].alt }}</span>
|
|
|
|
</span>
|
|
|
|
<Button :icon="fullScreenIcon" @click="toggleFullScreen" class="fullscreen-button" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Galleria>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { PhotoService } from '@/service/PhotoService';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
images: null,
|
|
|
|
activeIndex: 0,
|
|
|
|
showThumbnails: false,
|
|
|
|
fullScreen: false,
|
2023-04-03 23:25:13 +00:00
|
|
|
isAutoPlay: true,
|
2023-02-28 08:29:30 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
PhotoService.getImages().then((data) => (this.images = data));
|
|
|
|
this.bindDocumentListeners();
|
|
|
|
},
|
|
|
|
methods: {
|
2023-03-28 14:00:36 +00:00
|
|
|
toggleAutoSlide() {
|
2023-04-03 23:25:13 +00:00
|
|
|
this.isAutoPlay = !this.isAutoPlay;
|
2023-03-28 14:00:36 +00:00
|
|
|
},
|
2023-02-28 08:29:30 +00:00
|
|
|
onThumbnailButtonClick() {
|
|
|
|
this.showThumbnails = !this.showThumbnails;
|
|
|
|
},
|
|
|
|
toggleFullScreen() {
|
|
|
|
if (this.fullScreen) {
|
|
|
|
this.closeFullScreen();
|
|
|
|
} else {
|
|
|
|
this.openFullScreen();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onFullScreenChange() {
|
|
|
|
this.fullScreen = !this.fullScreen;
|
|
|
|
},
|
|
|
|
openFullScreen() {
|
|
|
|
let elem = this.$refs.galleria.$el;
|
|
|
|
|
|
|
|
if (elem.requestFullscreen) {
|
|
|
|
elem.requestFullscreen();
|
|
|
|
} else if (elem.mozRequestFullScreen) {
|
|
|
|
/* Firefox */
|
|
|
|
elem.mozRequestFullScreen();
|
|
|
|
} else if (elem.webkitRequestFullscreen) {
|
|
|
|
/* Chrome, Safari & Opera */
|
|
|
|
elem.webkitRequestFullscreen();
|
|
|
|
} else if (elem.msRequestFullscreen) {
|
|
|
|
/* IE/Edge */
|
|
|
|
elem.msRequestFullscreen();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
closeFullScreen() {
|
|
|
|
if (document.exitFullscreen) {
|
|
|
|
document.exitFullscreen();
|
|
|
|
} else if (document.mozCancelFullScreen) {
|
|
|
|
document.mozCancelFullScreen();
|
|
|
|
} else if (document.webkitExitFullscreen) {
|
|
|
|
document.webkitExitFullscreen();
|
|
|
|
} else if (document.msExitFullscreen) {
|
|
|
|
document.msExitFullscreen();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
bindDocumentListeners() {
|
|
|
|
document.addEventListener('fullscreenchange', this.onFullScreenChange);
|
|
|
|
document.addEventListener('mozfullscreenchange', this.onFullScreenChange);
|
|
|
|
document.addEventListener('webkitfullscreenchange', this.onFullScreenChange);
|
|
|
|
document.addEventListener('msfullscreenchange', this.onFullScreenChange);
|
|
|
|
},
|
|
|
|
unbindDocumentListeners() {
|
|
|
|
document.removeEventListener('fullscreenchange', this.onFullScreenChange);
|
|
|
|
document.removeEventListener('mozfullscreenchange', this.onFullScreenChange);
|
|
|
|
document.removeEventListener('webkitfullscreenchange', this.onFullScreenChange);
|
|
|
|
document.removeEventListener('msfullscreenchange', this.onFullScreenChange);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2023-03-28 14:00:36 +00:00
|
|
|
slideButtonIcon() {
|
2023-04-03 23:25:13 +00:00
|
|
|
return this.isAutoPlay ? 'pi pi-pause' : 'pi pi-play';
|
2023-03-28 14:00:36 +00:00
|
|
|
},
|
2023-02-28 08:29:30 +00:00
|
|
|
galleriaClass() {
|
|
|
|
return ['custom-galleria', { fullscreen: this.fullScreen }];
|
|
|
|
},
|
|
|
|
fullScreenIcon() {
|
|
|
|
return \`pi ${this.fullScreen ? 'pi-window-minimize' : 'pi-window-maximize'}\`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
<\/script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
::v-deep(.custom-galleria) {
|
|
|
|
&.fullscreen {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
.p-galleria-content {
|
|
|
|
flex-grow: 1;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-content {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-thumbnail-wrapper {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-thumbnail-items-container {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-galleria-footer {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
background-color: rgba(0, 0, 0, 0.9);
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
background-color: transparent;
|
|
|
|
color: #ffffff;
|
|
|
|
border: 0 none;
|
|
|
|
border-radius: 0;
|
|
|
|
margin: 0.2rem 0;
|
|
|
|
|
|
|
|
&.fullscreen-button {
|
|
|
|
margin-left: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.title-container {
|
|
|
|
> span {
|
|
|
|
font-size: 0.9rem;
|
|
|
|
padding-left: 0.829rem;
|
|
|
|
|
|
|
|
&.title {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-15 09:38:39 +00:00
|
|
|
</style>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2023-10-04 09:32:01 +00:00
|
|
|
<div class="card">
|
2023-02-28 08:29:30 +00:00
|
|
|
<Galleria ref="galleria" v-model:activeIndex="activeIndex" :value="images" :numVisible="5" containerStyle="max-width: 640px" :containerClass="galleriaClass"
|
2023-04-03 23:25:13 +00:00
|
|
|
:showThumbnails="showThumbnails" :showItemNavigators="true" :showItemNavigatorsOnHover="true" :circular="true" :autoPlay="isAutoPlay" :transitionInterval="3000">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #item="slotProps">
|
|
|
|
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" :style="[{ width: !fullScreen ? '100%' : '', display: !fullScreen ? 'block' : '' }]" />
|
|
|
|
</template>
|
|
|
|
<template #thumbnail="slotProps">
|
|
|
|
<div class="grid grid-nogutter justify-content-center">
|
|
|
|
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" style="display: block" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #footer>
|
|
|
|
<div class="custom-galleria-footer">
|
|
|
|
<Button icon="pi pi-list" @click="onThumbnailButtonClick" />
|
2023-03-28 14:00:36 +00:00
|
|
|
<Button :icon="slideButtonIcon" @click="toggleAutoSlide" />
|
2023-02-28 08:29:30 +00:00
|
|
|
<span v-if="images" class="title-container">
|
|
|
|
<span>{{ activeIndex + 1 }}/{{ images.length }}</span>
|
|
|
|
<span class="title">{{ images[activeIndex].title }}</span>
|
|
|
|
<span>{{ images[activeIndex].alt }}</span>
|
|
|
|
</span>
|
|
|
|
<Button :icon="fullScreenIcon" @click="toggleFullScreen" class="fullscreen-button" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Galleria>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref, computed, onMounted } from "vue";
|
|
|
|
import { PhotoService } from '@/service/PhotoService';
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
PhotoService.getImages().then((data) => (images.value = data));
|
|
|
|
bindDocumentListeners();
|
|
|
|
});
|
|
|
|
|
|
|
|
const galleria = ref();
|
|
|
|
const images = ref();
|
|
|
|
const activeIndex = ref(0);
|
|
|
|
const showThumbnails = ref(false);
|
|
|
|
const fullScreen = ref(false);
|
2023-04-03 23:25:13 +00:00
|
|
|
const isAutoPlay = ref(true);
|
2023-02-28 08:29:30 +00:00
|
|
|
|
2023-03-28 14:00:36 +00:00
|
|
|
const toggleAutoSlide = () => {
|
2023-04-03 23:25:13 +00:00
|
|
|
isAutoPlay.value = !isAutoPlay.value ;
|
2023-03-28 14:00:36 +00:00
|
|
|
};
|
2023-02-28 08:29:30 +00:00
|
|
|
const onThumbnailButtonClick = () => {
|
|
|
|
showThumbnails.value = !showThumbnails.value ;
|
|
|
|
};
|
|
|
|
const toggleFullScreen = () => {
|
|
|
|
if (fullScreen.value ) {
|
|
|
|
closeFullScreen();
|
|
|
|
} else {
|
|
|
|
openFullScreen();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const onFullScreenChange = () => {
|
|
|
|
fullScreen.value = !fullScreen.value ;
|
|
|
|
};
|
|
|
|
const openFullScreen = () =>{
|
|
|
|
let elem = galleria.value.$el;
|
|
|
|
|
|
|
|
if (elem.requestFullscreen) {
|
|
|
|
elem.requestFullscreen();
|
|
|
|
} else if (elem.mozRequestFullScreen) {
|
|
|
|
/* Firefox */
|
|
|
|
elem.mozRequestFullScreen();
|
|
|
|
} else if (elem.webkitRequestFullscreen) {
|
|
|
|
/* Chrome, Safari & Opera */
|
|
|
|
elem.webkitRequestFullscreen();
|
|
|
|
} else if (elem.msRequestFullscreen) {
|
|
|
|
/* IE/Edge */
|
|
|
|
elem.msRequestFullscreen();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const closeFullScreen = () => {
|
|
|
|
if (document.exitFullscreen) {
|
|
|
|
document.exitFullscreen();
|
|
|
|
} else if (document.mozCancelFullScreen) {
|
|
|
|
document.mozCancelFullScreen();
|
|
|
|
} else if (document.webkitExitFullscreen) {
|
|
|
|
document.webkitExitFullscreen();
|
|
|
|
} else if (document.msExitFullscreen) {
|
|
|
|
document.msExitFullscreen();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const bindDocumentListeners = () => {
|
|
|
|
document.addEventListener('fullscreenchange', onFullScreenChange);
|
|
|
|
document.addEventListener('mozfullscreenchange', onFullScreenChange);
|
|
|
|
document.addEventListener('webkitfullscreenchange', onFullScreenChange);
|
|
|
|
document.addEventListener('msfullscreenchange', onFullScreenChange);
|
|
|
|
};
|
|
|
|
const unbindDocumentListeners = () => {
|
|
|
|
document.removeEventListener('fullscreenchange', onFullScreenChange);
|
|
|
|
document.removeEventListener('mozfullscreenchange', onFullScreenChange);
|
|
|
|
document.removeEventListener('webkitfullscreenchange', onFullScreenChange);
|
|
|
|
document.removeEventListener('msfullscreenchange', onFullScreenChange);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const galleriaClass = computed(() => {
|
|
|
|
return ['custom-galleria', { fullscreen: fullScreen.value }];
|
|
|
|
});
|
|
|
|
const fullScreenIcon = computed(() => {
|
|
|
|
return \`pi \${fullScreen.value ? 'pi-window-minimize' : 'pi-window-maximize'}\`;
|
|
|
|
});
|
2023-03-28 14:00:36 +00:00
|
|
|
const slideButtonIcon = computed(() => {
|
2023-04-03 23:25:13 +00:00
|
|
|
return \`pi \${isAutoPlay.value ? 'pi-pause' : 'pi-play'}\`;
|
2023-03-28 14:00:36 +00:00
|
|
|
});
|
2023-02-28 08:29:30 +00:00
|
|
|
<\/script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
::v-deep(.custom-galleria) {
|
|
|
|
&.fullscreen {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
.p-galleria-content {
|
|
|
|
flex-grow: 1;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-content {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-thumbnail-wrapper {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-thumbnail-items-container {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-galleria-footer {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
background-color: rgba(0, 0, 0, 0.9);
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
background-color: transparent;
|
|
|
|
color: #ffffff;
|
|
|
|
border: 0 none;
|
|
|
|
border-radius: 0;
|
|
|
|
margin: 0.2rem 0;
|
|
|
|
|
|
|
|
&.fullscreen-button {
|
|
|
|
margin-left: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.title-container {
|
|
|
|
> span {
|
|
|
|
font-size: 0.9rem;
|
|
|
|
padding-left: 0.829rem;
|
|
|
|
|
|
|
|
&.title {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>`,
|
|
|
|
data: `
|
|
|
|
/* PhotoService */
|
|
|
|
{
|
|
|
|
itemImageSrc: 'https://primefaces.org/cdn/primevue/images/galleria/galleria1.jpg',
|
|
|
|
thumbnailImageSrc: 'https://primefaces.org/cdn/primevue/images/galleria/galleria1s.jpg',
|
|
|
|
alt: 'Description for Image 1',
|
|
|
|
title: 'Title 1'
|
|
|
|
},
|
|
|
|
...
|
|
|
|
`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
PhotoService.getImages().then((data) => (this.images = data));
|
|
|
|
this.bindDocumentListeners();
|
|
|
|
},
|
|
|
|
methods: {
|
2023-03-28 14:00:36 +00:00
|
|
|
toggleAutoSlide() {
|
2023-04-03 23:25:13 +00:00
|
|
|
this.isAutoPlay = !this.isAutoPlay;
|
2023-03-28 14:00:36 +00:00
|
|
|
},
|
2023-02-28 08:29:30 +00:00
|
|
|
onThumbnailButtonClick() {
|
|
|
|
this.showThumbnails = !this.showThumbnails;
|
|
|
|
},
|
|
|
|
toggleFullScreen() {
|
|
|
|
if (this.fullScreen) {
|
|
|
|
this.closeFullScreen();
|
|
|
|
} else {
|
|
|
|
this.openFullScreen();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onFullScreenChange() {
|
|
|
|
this.fullScreen = !this.fullScreen;
|
|
|
|
},
|
|
|
|
openFullScreen() {
|
|
|
|
let elem = this.$refs.galleria.$el;
|
|
|
|
|
|
|
|
if (elem.requestFullscreen) {
|
|
|
|
elem.requestFullscreen();
|
|
|
|
} else if (elem.mozRequestFullScreen) {
|
|
|
|
/* Firefox */
|
|
|
|
elem.mozRequestFullScreen();
|
|
|
|
} else if (elem.webkitRequestFullscreen) {
|
|
|
|
/* Chrome, Safari & Opera */
|
|
|
|
elem.webkitRequestFullscreen();
|
|
|
|
} else if (elem.msRequestFullscreen) {
|
|
|
|
/* IE/Edge */
|
|
|
|
elem.msRequestFullscreen();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
closeFullScreen() {
|
|
|
|
if (document.exitFullscreen) {
|
|
|
|
document.exitFullscreen();
|
|
|
|
} else if (document.mozCancelFullScreen) {
|
|
|
|
document.mozCancelFullScreen();
|
|
|
|
} else if (document.webkitExitFullscreen) {
|
|
|
|
document.webkitExitFullscreen();
|
|
|
|
} else if (document.msExitFullscreen) {
|
|
|
|
document.msExitFullscreen();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
bindDocumentListeners() {
|
|
|
|
document.addEventListener('fullscreenchange', this.onFullScreenChange);
|
|
|
|
document.addEventListener('mozfullscreenchange', this.onFullScreenChange);
|
|
|
|
document.addEventListener('webkitfullscreenchange', this.onFullScreenChange);
|
|
|
|
document.addEventListener('msfullscreenchange', this.onFullScreenChange);
|
|
|
|
},
|
|
|
|
unbindDocumentListeners() {
|
|
|
|
document.removeEventListener('fullscreenchange', this.onFullScreenChange);
|
|
|
|
document.removeEventListener('mozfullscreenchange', this.onFullScreenChange);
|
|
|
|
document.removeEventListener('webkitfullscreenchange', this.onFullScreenChange);
|
|
|
|
document.removeEventListener('msfullscreenchange', this.onFullScreenChange);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2023-03-28 14:00:36 +00:00
|
|
|
slideButtonIcon() {
|
2023-04-03 23:25:13 +00:00
|
|
|
return this.isAutoPlay ? 'pi pi-pause' : 'pi pi-play';
|
2023-03-28 14:00:36 +00:00
|
|
|
},
|
2023-02-28 08:29:30 +00:00
|
|
|
galleriaClass() {
|
|
|
|
return ['custom-galleria', { fullscreen: this.fullScreen }];
|
|
|
|
},
|
|
|
|
fullScreenIcon() {
|
|
|
|
return `pi ${this.fullScreen ? 'pi-window-minimize' : 'pi-window-maximize'}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
::v-deep(.custom-galleria) {
|
|
|
|
&.fullscreen {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
.p-galleria-content {
|
|
|
|
flex-grow: 1;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-content {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-thumbnail-wrapper {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-galleria-thumbnail-items-container {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-galleria-footer {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
background-color: rgba(0, 0, 0, 0.9);
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
background-color: transparent;
|
|
|
|
color: #ffffff;
|
|
|
|
border: 0 none;
|
|
|
|
border-radius: 0;
|
|
|
|
margin: 0.2rem 0;
|
|
|
|
|
|
|
|
&.fullscreen-button {
|
|
|
|
margin-left: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.title-container {
|
|
|
|
> span {
|
|
|
|
font-size: 0.9rem;
|
|
|
|
padding-left: 0.829rem;
|
|
|
|
|
|
|
|
&.title {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|