pdp/사양안내 업로드

This commit is contained in:
hyeonggil
2024-06-19 17:56:18 +09:00
parent 6f7e860912
commit f21d830235
22 changed files with 248 additions and 48 deletions

View File

@@ -267,6 +267,7 @@ $(document).ready(function() {
pdpInCarGameSwiper()
pdpInCarGameSwiperDtl();
pdpIntro();
flagScroll = false;
}
}
@@ -447,7 +448,7 @@ function pdpInCarGameSwiper(){
// },
on: {
init: function () {
console.log('pdpInCarGameSwiper 실행한다')
// console.log('pdpInCarGameSwiper 실행한다')
},
},
});
@@ -463,9 +464,10 @@ function pdpInCarGameSwiper(){
}
});
}
flagScroll = false;
}
let inCarGameSwiper;
function pdpInCarGameSwiperDtl(){
if ($('.inCarGameDtl').length > 0) {
var inCarGameSwiper = new Swiper(".inCarGameDtlThumb", {
@@ -483,9 +485,16 @@ function pdpInCarGameSwiperDtl(){
thumbs: {
swiper: inCarGameSwiper,
},
on: {
init: function () {
$(document).on("click", ".inCarGame .dtthumb", function() {
inCarGameSwiper.slideTo(0);
inCarGameSwiper2.slideTo(0);
});
},
},
});
}
flagScroll = false;
}
$(document).on("click", ".inCarGame .dtthumb", function(e) {
@@ -504,15 +513,42 @@ $(document).on("click", ".inCarGame .dtthumb", function(e) {
}, 200);
$(".inCarGame .themeImg").each(function(e){
const idx = e+1;
const idx = e+2;
const src = $(this).attr("src");
const lastIndex = src.lastIndexOf("/");
const pathWithoutFileName = src.substring(0, lastIndex);
$(this).attr("src", `${pathWithoutFileName}/${dtlImgPath}-${idx}.png`);
});
$(".inCarGame .themeImgThumb").each(function(e){
$(".inCarGame .video-slide").each(function(e){
const idx = e+1;
const src = $(this).find(".themeVideo").attr("src");
const lastIndex = src.lastIndexOf("/");
const pathWithoutFileName = src.substring(0, lastIndex);
const videoEle = `
<video loop="" muted="" playsinline="" autoplay="" poster="${pathWithoutFileName}/${dtlImgPath}-1.png">
<source src="${pathWithoutFileName}/${dtlImgPath}-1.mp4" type="video/mp4" class="themeVideo">
</video>
`;
$(this).html(videoEle);
// $(this).attr("src", `${pathWithoutFileName}/${dtlImgPath}-${idx}.mp4`);
});
$(".inCarGame .video-slideThumb").each(function(e){
const idx = e+1;
const src = $(this).find(".themeVideo").attr("src");
const lastIndex = src.lastIndexOf("/");
const pathWithoutFileName = src.substring(0, lastIndex);
const videoEle = `
<video loop="" muted="" playsinline="" poster="${pathWithoutFileName}/${dtlImgPath}-1.png">
<source src="${pathWithoutFileName}/${dtlImgPath}-1.mp4" type="video/mp4" class="themeVideo">
</video>
`;
$(this).html(videoEle);
// $(this).attr("src", `${pathWithoutFileName}/${dtlImgPath}-${idx}.mp4`);
});
$(".inCarGame .themeImgThumb").each(function(e){
const idx = e+2;
const src = $(this).attr("src");
const lastIndex = src.lastIndexOf("/");
const pathWithoutFileName = src.substring(0, lastIndex);
@@ -589,31 +625,33 @@ $(document).on("click", ".displayTheme .dtthumb", function() {
});
function pdpIntro(){
const videoElement = document.getElementById('dpThemeVideo');
const videoWrap = $('.displayTheme .video_wrap');
const btnIntro = $('.displayTheme .btn-intro');
const btnClose = $('.video_wrap .btn-close');
if($('#dpThemeVideo').length > 0){
const videoElement = document.getElementById('dpThemeVideo');
const videoWrap = $('.displayTheme .video_wrap');
const btnIntro = $('.displayTheme .btn-intro');
const btnClose = $('.video_wrap .btn-close');
videoElement.addEventListener('ended', function() {
$(videoWrap).fadeOut('fast',function(){
videoElement.currentTime = 0;
videoElement.pause();
videoElement.addEventListener('ended', function() {
$(videoWrap).fadeOut('fast',function(){
videoElement.currentTime = 0;
videoElement.pause();
});
});
});
$(btnIntro).on('click', function() {
$(videoWrap).fadeIn('fast',function(){
videoElement.currentTime = 0;
videoElement.play();
});
});
$(btnClose).on('click', function() {
$(videoWrap).fadeOut('fast',function(){
videoElement.currentTime = 0;
videoElement.pause();
$(btnIntro).on('click', function() {
$(videoWrap).fadeIn('fast',function(){
videoElement.currentTime = 0;
videoElement.play();
});
});
$(btnClose).on('click', function() {
$(videoWrap).fadeOut('fast',function(){
videoElement.currentTime = 0;
videoElement.pause();
});
});
});
}
}