디스플레이테마 인트로 영상 영역 수정

This commit is contained in:
2024-07-11 23:14:56 +09:00
parent 41158ec39f
commit 840da699c8
6 changed files with 615 additions and 339 deletions

View File

@@ -640,8 +640,15 @@ $(document).on("click", ".displayTheme .dtthumb", function() {
function pdpIntro() {
// dpThemeVideo 요소가 존재하는지 확인
if ($('.video_wrap video').length > 0) {
$(".displayTheme").addClass('playing')
if (getCookie('hideIntroPopup')) {
$(".displayTheme").removeClass('playing')
$(".video_wrap").hide();
}
// .video_wrap 내 모든 비디오 요소 선택
const videoElements = document.querySelectorAll('.video_wrap video');
videoElements.forEach(video => {
const videoWrap = $('.displayTheme .video_wrap');
@@ -654,6 +661,7 @@ function pdpIntro() {
// 비디오 재생이 끝났을 때 이벤트 리스너 추가
video.addEventListener('ended', function() {
// console.log("addEventListener ended 실행");
$(".displayTheme").removeClass('playing')
$(videoWrap).hide();
// 비디오 재생이 끝나면 비디오 숨기기
// $(videoWrap).fadeOut('fast',function(){
@@ -667,6 +675,7 @@ function pdpIntro() {
// .btn-intro 버튼 클릭 시 비디오 재생
$(document).on("click", ".displayTheme .btn-intro", function() {
// console.log('intro 다시 실행');
$(".displayTheme").addClass('playing')
$(videoWrap).show();
if (video) {
video.currentTime = 0;
@@ -677,6 +686,7 @@ function pdpIntro() {
// .btn-close 버튼 클릭 시 비디오 숨기기
$(document).on("click", ".video_wrap .btn-close", function() {
// console.log('btn close 실행');
$(".displayTheme").removeClass('playing');
$(videoWrap).hide();
if (video) {
video.currentTime = 0;
@@ -902,12 +912,31 @@ $.fn.clearForm = function () {
}
});
};
// 쿠키 설정 함수
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
// $(document).on("click", ".video_wrap .btn-close", function() {
// alert("클릭")
// $(".video_wrap").fadeOut('fast',function(){
// videoElements.currentTime = 0;
// videoElements.pause();
// });
// })
// 쿠키 가져오는 함수
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
// 팝업을 숨기는 함수
function hideTodayIntroPopup() {
$(".video_wrap").hide();
$(".displayTheme").removeClass('playing');
setCookie('hideIntroPopup', 'true', 1);
}