Open helloMihyun opened 5 years ago
`
function uiLayer(){
$('.js_layer').click(function(){
var $dataTarget = $(this).attr('data-target'),
$dataVod = $(this).attr('data-vod');
var replaceVod = $dataVod.replace(/\/,'');
if($dataTarget){
if(replaceVod){
$('#'+$dataTarget).find('.frame_vod').append('<iframe width="1000" height="563" src="'+ replaceVod +'" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>');
}
$('body').addClass('layer__active');
$('#'+$dataTarget).addClass('is__active');
setTimeout(function(){
$('#'+$dataTarget).find('.dimmed__layer').fadeIn('fast');
}, 300);
}
return false;
});
if($('.layer__wrapper').hasClass('layer_open')){
$('body').addClass('layer__active');
$('.layer_open').addClass('is__active');
setTimeout(function(){
$('.layer__wrapper.layer_open').find('.dimmed__layer').fadeIn('fast');
}, 300);
}
$('.js_ly_close').click(function(){
var $ele = $(this).parents('.layer__wrapper');
$ele.addClass('is__delay');
$ele.find('.dimmed__layer').fadeOut('fast');
setTimeout(function(){
$ele.removeClass('is__delay');
$('body').removeClass('layer__active');
$ele.removeClass('is__active');
$ele.find('.frame_vod').empty();
}, 300);
return false;
});
} `
string.replace(/\/,''); 특수문자는 백슬래쉬로 탈출해야하기때문에 백슬래쉬 두개를 붙여야 합니다.
`$('.js_layer').click(function(){ var $dataTarget = $(this).attr('data-target'), $dataVod = $(this).attr('data-vod');
var replaceVod = $dataVod.replace(/\/,''); if($dataTarget){ if(replaceVod){ $('#'+$dataTarget).find('.frame_vod').append(''); }