function randomizeBestProductSlides() {
var slider = $(".single-item");
var slides = slider.children(".ow-box");
for (var i = slides.length - 1; i >= 0; i--) {
slider.append(slides.splice(Math.floor(Math.random() * (i + 1)), 1)[0]);
}
// nav ¼¼ÆÃ
slider.children(".ow-box").each(function(i, slide) {
var img_src = $(slide).find('div.img > img').attr('src');
$('.slider-nav').append(`
`);
});
}
(function($) {
$('.main-slider').on('init', function(event, slick) {
$('.main-slider').find('.slick-current').removeClass('slick-active').addClass('reset-animation');
setTimeout( function() {
$('.main-slider').find('.slick-current').removeClass('reset-animation').addClass('slick-active');
}, 1);
});
let vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', vh + 'px');
window.addEventListener('resize', function () {
let vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', vh + 'px');
});
// ¸ÞÀÎ ºñÁÖ¾ó ½½¶óÀÌ´õ
$('.main-slider').slick({
fade:true,
slidesToShow: 1,
draggable:true,
speed:1200,
lazyLoad: true,
autoplay: true,
dots: true,
autoplaySpeed:4000,
pauseOnFocus:false,
pauseOnHover:false,
pauseOnDotsHover:false,
pauseOnArrowsHover:false,
appendArrows:$('.arrow-con > .arrows'),
prevArrow:' ',
nextArrow:' ',
});
$('.main-slider').on('touchstart', e => {
$('.main-slider').slick('slickPlay');
});
randomizeBestProductSlides();
// OUR WORK ½½¶óÀÌ´õ
$('.single-item').slick({
dots: false,
centerMode: true,
slidesToShow: 1,
autoplay: true,
asNavFor: '.slider-nav',
speed: 1000,
autoplaySpeed: 3000,
lazyLoad: false,
pauseOnFocus:false,
pauseOnHover:false,
arrows: true,
});
$('.slider-nav').slick({
slidesToShow: 4,
slidesToScroll: 1,
asNavFor: '.single-item',
focusOnSelect: true,
infinite: true,
arrows: false,
autoplay: true,
centerMode: true
});
$(window).on('resize orientationchange', function() {
if ($(window).width() > 1200) {
$('.slider-nav').slick('unslick');
$('.slider-nav').slick({
slidesToShow: 4,
slidesToScroll: 1,
asNavFor: '.single-item',
focusOnSelect: true,
infinite: true,
arrows: false,
autoplay: true,
centerMode: true
});
}
});
$('.footer-select').on('click','.placeholder',function(){
var parent = $(this).closest('.footer-select');
if ( ! parent.hasClass('is-open')){
parent.addClass('is-open');
$('.footer-select.is-open').not(parent).removeClass('is-open');
}else{
parent.removeClass('is-open');
}
}).on('click','ul>li',function(){
var parent = $(this).closest('.footer-select');
parent.removeClass('is-open').find('.placeholder').text( $(this).text() );
});
$(".nav-mobile-button").click(function() {
$('.nav-mobile-bar').toggleClass('active');
$('.nav-mobile-menu').toggleClass('active');
});
var currentScrollTop = 0;
window.onload = function() {
scrollController();
$(window).on('scroll', function() {
scrollController();
});
}
jQuery(document).ready(function($){
var current_path =window.location.pathname;
console.log(current_path);
$('.submenu ul li a[href="'+current_path+'"]').addClass('active');
var search = window.location.search;
$('.sul_menu div a[href="'+current_path+search+'"]').parent().addClass('on');
});
$(document).ready(function(){
$("#go-top").hide();
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#go-top').fadeIn();
} else {
$('#go-top').fadeOut();
}
});
$('#go-top a').click(function () {
$('body,html').animate({
scrollTop: 0
});
return false;
});
});
});
jQuery(document).ready(function($){
var current_path =window.location.pathname;
console.log(current_path);
$('.sul_menu ul li a[href="'+current_path+'"]').addClass('active');
var code = getParameter('com_board_category_code')
if (code) {
code = code.split("c")[1]
$('.sul_menu a').eq(code).addClass("active_menu")
} else {
$('.sul_menu a').eq(0).addClass("active_menu") }
function getParameter(name) {
var half = location.search.split(name + '=')[1];
return half !== undefined ? decodeURIComponent(half.split('&')[0]) : null;
}
});
// FAQ
$(".open").click(function() {
var container = $(this).parents(".faq-box");
var answer = container.find(".answer");
var trigger = container.find(".faq-t");
answer.slideToggle(200);
if (trigger.hasClass("faq-o")) {
trigger.removeClass("faq-o");
} else {
trigger.addClass("faq-o");
}
if (container.hasClass("expanded")) {
container.removeClass("expanded");
} else {
container.addClass("expanded");
}
});
jQuery(document).ready(function($) {
$('.question').each(function() {
$(this).attr('data-search-term', $(this).text().toLowerCase() + $(this).find("ptag").text().toLowerCase());
});
$('.live-search-box').on('keyup', function() {
var searchTerm = $(this).val().toLowerCase();
$('.question').each(function() {
if ($(this).filter('[data-search-term *= ' + searchTerm + ']').length > 0 || searchTerm.length < 1) {
$(this).parent().parent().show();
} else {
$(this).parent().parent().hide();
}
});
});
});
$(function(){
var $refreshButton = $('#refresh');
var $results = $('#css_result');
function refresh(){
var css = $('style.cp-pen-styles').text();
$results.html(css);
}
refresh();
$refreshButton.click(refresh);
// Select all the contents when clicked
$results.click(function(){
$(this).select();
});
});
})(jQuery);
//audio
$(function(){
window.AudioPlayer = function (control, sources, options) {
this.control = control;
options = options || AudioPlayer.defaults;
options = $.extend({
size: 'medium',
backColorClass: '',
controlColorClass: '',
sliderColorClass: '',
progressColorClass: '',
textColorClass: ''
}, options);
this.template = '';
this.AudioPlayer(sources, options);
};
window.AudioPlayer.prototype = {
AudioPlayer: function AudioPlayer(sources, options) {
var self = this;
self.draggableClasses = ['pin'];
self.currentlyDragged = null;
// Init related components
self.$root = $(self.control);
self.$player = $(self.template);
self.$audio = $(' ');
self.$loading = self.$player.find(".loading");
self.$playpauseBtn = self.$player.find(".play-pause-btn");
self.$progress = self.$player.find(".controls .progress");
self.$sliders = self.$player.find(".slider");
self.$pins = self.$player.find(".pin");
self.$volumeBtn = self.$player.find(".volume-btn");
self.$volumeControls = self.$player.find(".volume-controls");
self.$volumeProgress = self.$player.find(".volume-controls .progress");
self.$currentTime = self.$player.find(".current-time");
self.$totalTime = self.$player.find(".total-time");
// Assemble Player
self.$root.append(self.$player);
self.$root.append(self.$audio);
// Setup classes
if(self.$root.data("size")){
options.size = self.$root.data("size");
}
self.$player.addClass(options.size)
debugger
if(self.$root.data("backcolorclass")){
options.backColorClass = self.$root.data("backcolorclass");
}
self.$player.addClass(options.backColorClass);
if(self.$root.data("controlcolorclass")){
options.controlColorClass = self.$root.data("controlcolorclass");
}
self.$player.addClass(options.controlColorClass);
if(self.$root.data("textcolorclass")){
options.textColorClass = self.$root.data("textcolorclass");
}
self.$currentTime.addClass(options.textcolorclass);
self.$totalTime.addClass(options.textcolorclass);
if(self.$root.data("slidercolorclass")){
options.sliderColorClass = self.$root.data("slidercolorclass");
}
self.$sliders.addClass(options.sliderColorClass);
if(self.$root.data("progresscolorclass")){
options.progressColorClass = self.$root.data("progresscolorclass");
}
self.$progress.addClass(options.progressColorClass);
self.$volumeProgress.addClass(options.progressColorClass);
self.$pins.addClass(options.progressColorClass);
// Setup sources
if(self.$root.data("src")){
sources = self.$root.data("src");
}
sources = (sources && sources.constructor === String) ? [sources] : sources;
$.each(sources, function (index, source) {
self.$audio.append($('').attr("src", source).attr("type", "audio/mpeg"));
});
// Audio Options
if(self.$root.data("loop")){
options.loop = self.$root.data("loop");
}
if(options.loop){
self.$audio.attr("loop", "true");
}
if(self.$root.data("autoplay")){
options.autoplay = self.$root.data("autoplay");
}
if(options.autoplay){
self.$audio.attr("autoplay", "true");
}
// Player Events
self.$playpauseBtn.on('click', function () {
self.togglePlay();
});
self.$audio.on('timeupdate', function () {
self.updateProgress();
});
self.$audio.on('volumechange', function () {
self.updateVolume();
});
self.$audio.on('loadedmetadata', function () {
self.$totalTime.text(self.formatTime(self.$audio[0].duration));
});
self.$audio.on('canplay', function () {
self.makePlay();
});
self.$audio.on('ended', function () {
self.$playPause.attr('d', 'M18 12L0 24V0');
self.$audio[0].currentTime = 0;
});
self.$volumeBtn.on('click', function () {
self.$volumeBtn.toggleClass('open');
self.$volumeControls.toggleClass('hidden');
});
self.$sliders.each(function () {
var pin = $(this).find('.pin');
$(this).on('click', function (event) {
self[pin.data('method')](event);
});
});
// Window Events
$(window).on('mousedown', function (event) {
if (!self.isDraggable(event.target)){
self.$volumeBtn.removeClass('open');
self.$volumeControls.addClass('hidden');
return false;
};
self.currentlyDragged = event.target;
var handleMethod = self.currentlyDragged.dataset.method;
$(window).on('mousemove.' + handleMethod, function (event) {
self[handleMethod](event);
});
$(window).on('mouseup.' + handleMethod, function () {
self.currentlyDragged = false;
$(window).off('.' + handleMethod);
});
});
$(window).on('resize', function () {
self.directionAware();
});
self.directionAware();
},
isDraggable: function isDraggable(el) {
var canDrag = false;
var classes = Array.from(el.classList);
this.draggableClasses.forEach(function (draggable) {
if (classes.indexOf(draggable) !== -1) canDrag = true;
});
return canDrag;
},
getRangeBox: function getRangeBox(event) {
var rangeBox = event.target;
var el = this.currentlyDragged;
if (event.type == 'click' && this.isDraggable(event.target)) {
rangeBox = event.target.parentElement.parentElement;
}
if (event.type == 'mousemove') {
rangeBox = el.parentElement.parentElement;
}
return rangeBox;
},
inRange: function inRange(event) {
var rangeBox = this.getRangeBox(event);
var rect = rangeBox.getBoundingClientRect();
var direction = rangeBox.dataset.direction;
if (direction == 'horizontal') {
var min = rangeBox.offsetLeft;
var max = min + rangeBox.offsetWidth;
if (event.clientX < min || event.clientX > max) return false;
} else {
var min = rect.top;
var max = min + rangeBox.offsetHeight;
if (event.clientY < min || event.clientY > max) return false;
}
return true;
},
updateProgress: function updateProgress() {
var current = this.$audio[0].currentTime;
var percent = current / this.$audio[0].duration * 100;
this.$progress.css('width', percent + '%');
this.$currentTime.text(this.formatTime(current));
},
updateVolume: function updateVolume() {
this.$volumeProgress.css('height', this.$audio[0].volume * 100 + '%');
if (this.$audio[0].volume >= 0.5) {
this.$volumeBtn.addClass("fa-volume-up");
this.$volumeBtn.removeClass("fa-volume-off");
this.$volumeBtn.removeClass("fa-volume-down");
} else if (this.$audio[0].volume < 0.5 && this.$audio[0].volume > 0.05) {
this.$volumeBtn.addClass("fa-volume-down");
this.$volumeBtn.removeClass("fa-volume-up");
this.$volumeBtn.removeClass("fa-volume-off");
} else if (this.$audio[0].volume <= 0.05) {
this.$volumeBtn.addClass("fa-volume-off");
this.$volumeBtn.removeClass("fa-volume-up");
this.$volumeBtn.removeClass("fa-volume-down");
}
},
getCoefficient: function getCoefficient(event) {
var slider = this.getRangeBox(event);
var rect = slider.getBoundingClientRect();
var K = 0;
if (slider.dataset.direction == 'horizontal') {
var offsetX = event.clientX - slider.offsetLeft;
var width = slider.clientWidth;
K = offsetX / width;
} else if (slider.dataset.direction == 'vertical') {
var height = slider.clientHeight;
var offsetY = event.clientY - rect.top;
K = 1 - offsetY / height;
}
return K;
},
rewind: function rewind(event) {
if (this.inRange(event)) {
if(this.$audio[0].currentTime)
this.$audio[0].currentTime = this.$audio[0].duration * this.getCoefficient(event);
}
},
changeVolume: function changeVolume(event) {
if (this.inRange(event)) {
this.$audio[0].volume = this.getCoefficient(event);
}
},
formatTime: function formatTime(time) {
var min = Math.floor(time / 60);
var sec = Math.floor(time % 60);
return min + ':' + (sec < 10 ? '0' + sec : sec);
},
togglePlay: function togglePlay() {
if (this.$audio[0].paused) {
this.$playpauseBtn.addClass("fa-pause");
this.$playpauseBtn.removeClass("fa-play");
this.$audio[0].play();
} else {
this.$playpauseBtn.addClass("fa-play");
this.$playpauseBtn.removeClass("fa-pause");
this.$audio[0].pause();
}
},
makePlay: function makePlay() {
this.$playpauseBtn.show();
this.$loading.hide();
},
directionAware: function directionAware() {
if (window.innerHeight < 250) {
this.$volumeControls.css('bottom', '-4.5em');
this.$volumeControls.css('left', '4.5em');
} else if (this.$player.offsetTop < 154) {
this.$volumeControls.css('bottom', '-13.667em');
this.$volumeControls.css('left', '-0.25em');
} else {
this.$volumeControls.css('bottom', '4.333em');
this.$volumeControls.css('left', '-0.25em');
}
}
};
window.AudioPlayer.defaults = {
size: 'medium',
backColorClass: 'backColorClass',
controlColorClass: 'controlColorClass',
sliderColorClass: 'sliderColorClass',
progressColorClass: 'progressColorClass',
textColorClass: 'textColorClass'
};
$(".n-audio-player").each(function(index, player){
new AudioPlayer(player);
});
})