js 파일들 정리
This commit is contained in:
@@ -0,0 +1,309 @@
|
||||
// 스크롤 유무
|
||||
$.fn.hasVerticalScrollbar = function() {
|
||||
return this.get(0).scrollHeight > this.height();
|
||||
}
|
||||
|
||||
// Scroll End
|
||||
var ignoreScroll = false;
|
||||
var ns = (new Date).getTime();
|
||||
var special = $.event.special;
|
||||
var dispatch = $.event.handle || $.event.dispatch;
|
||||
var scroll = 'scroll';
|
||||
var scrollEnd = scroll + 'end';
|
||||
var nsScrollEnd = scroll + '.' + scrollEnd + ns
|
||||
special.scrollend = {
|
||||
delay: 300,
|
||||
setup: function() {
|
||||
var pid, handler = function(e) {
|
||||
var _this = this,
|
||||
args = arguments;
|
||||
|
||||
clearTimeout(pid);
|
||||
pid = setTimeout(function() {
|
||||
e.type = scrollEnd;
|
||||
dispatch.apply(_this, args);
|
||||
}, special.scrollend.delay);
|
||||
};
|
||||
|
||||
$(this).on(nsScrollEnd, handler);
|
||||
},
|
||||
teardown: function() {
|
||||
$(this).off(nsScrollEnd);
|
||||
}
|
||||
};
|
||||
|
||||
// Touch Prevent
|
||||
function lockTouch(e) {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
// is Mobile
|
||||
function _isMobile() {
|
||||
var isMobile = (/iphone|ipod|android|blackberry|fennec/).test(navigator.userAgent.toLowerCase());
|
||||
return isMobile;
|
||||
}
|
||||
|
||||
// Responsive 이미지 변환
|
||||
function ResponsiveImagesNew() {
|
||||
$(".imgResponsive").each(function() {
|
||||
var winW = window.innerWidth;
|
||||
if (winW > 1023 && $(this).attr("data-media-type") != "pc") {
|
||||
var url = $(this).attr("data-src-pc");
|
||||
$(this).attr("data-media-type", "pc");
|
||||
chgImg($(this), url, "pc");
|
||||
}
|
||||
if (winW <= 1023 && $(this).attr("data-media-type") != "mobile") {
|
||||
var url = $(this).attr("data-src-mobile");
|
||||
$(this).attr("data-media-type", "mobile");
|
||||
chgImg($(this), url, "mobile");
|
||||
}
|
||||
});
|
||||
|
||||
function chgImg($target, url, type) {
|
||||
$target.attr("src", url);
|
||||
$target.attr("data-media-type", type);
|
||||
}
|
||||
|
||||
var winW = window.innerWidth;
|
||||
|
||||
if ($('#contents').length) {
|
||||
if ($('#contents').outerHeight(true) + $('#header').outerHeight(true) + $('#footer').outerHeight(true) <= window.innerHeight) {
|
||||
$('#contents').css({
|
||||
minHeight: window.innerHeight - $('#header').outerHeight(true) - $('#footer').outerHeight(true)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LayerPopup 열기
|
||||
var idxLayPop = 0;
|
||||
function layerPop(n, target){
|
||||
|
||||
if(n == 'open'){
|
||||
idxLayPop = idxLayPop + 1;
|
||||
var sct = $(document).scrollTop();
|
||||
var settings = {
|
||||
opacity : 0,
|
||||
y : -100
|
||||
}
|
||||
|
||||
TweenMax.set($('.layerPop'+target), {zIndex : 9999 + idxLayPop});
|
||||
TweenMax.set($('.layerPop'+target).find('.layerPopArea'), settings);
|
||||
|
||||
//퀵모임 SMS미리보기 버튼 클릭시만 사용
|
||||
if($('#layerSmsPhrases').length > 0){
|
||||
appVue.onPopupOpen();
|
||||
}
|
||||
$('html').addClass('closeHidden');
|
||||
|
||||
$('.layerPop'+target).stop().fadeIn(300, function(){
|
||||
TweenMax.to($('.layerPop'+target).find('.layerPopArea'), 0.4, {
|
||||
opacity : 1,
|
||||
y : 0
|
||||
});
|
||||
|
||||
//$('.layerPop'+target).find('.popCont').css({height : $('.layerPop'+target).find('.layerPopArea').outerHeight(true) - $('.layerPop'+target).find('.popupHead').outerHeight(true) - $('.layerPop'+target).find('.popFoot').outerHeight(true)});
|
||||
});
|
||||
|
||||
}else{
|
||||
idxLayPop = idxLayPop - 1;
|
||||
TweenMax.to($('.layerPop'+target).find('.layerPopArea'), 0.4, {
|
||||
opacity : 0,
|
||||
y : -100,
|
||||
onComplete : function(){
|
||||
$('.layerPop'+target).stop().fadeOut(300, function(){
|
||||
$('.layerPop'+target).find('.layerPopArea').removeAttr('style');
|
||||
});
|
||||
|
||||
$('.layerPop'+target).find('.popCont').removeAttr('style');
|
||||
|
||||
if($('html').css('margin-top').length){
|
||||
var sct = Math.abs(parseInt($('html').css('margin-top')));
|
||||
//$('html').scrollTop(sct);
|
||||
$('html').removeAttr('style');
|
||||
}
|
||||
|
||||
$('html').removeClass('closeHidden');
|
||||
|
||||
}
|
||||
});
|
||||
if(n == 'close'&& target=="#POPUP_USER_SELECT" ){
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 아코디언
|
||||
function accodianUI() {
|
||||
var el = $('.accordianList');
|
||||
|
||||
if (el.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
el.find('>ul>li').removeClass('on');
|
||||
|
||||
bindEvents();
|
||||
|
||||
function bindEvents() {
|
||||
el.find('>ul>li>dl>dt>a').off('click.accodianEvt').on('click.accodianEvt', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var index = $(this).closest('li').index();
|
||||
|
||||
$(this).closest(el).find('>ul>li').each(function(idx, obj) {
|
||||
if (idx == index) {
|
||||
if ($(obj).hasClass('on')) {
|
||||
$(obj).removeClass('on');
|
||||
} else {
|
||||
$(obj).addClass('on');
|
||||
}
|
||||
} else {
|
||||
$(obj).removeClass('on');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 탭 메뉴
|
||||
function tabUI() {
|
||||
var el = $('.tabsGroup');
|
||||
|
||||
if(el.length <= 0){
|
||||
return;
|
||||
}
|
||||
|
||||
el.each(function(idx, obj){
|
||||
if($(obj).find('.tabs > li').hasClass('on')){
|
||||
$(obj).find('.tabs > li').each(function(){
|
||||
var idx = $(this).filter('.on').index();
|
||||
if(idx >= 0){
|
||||
$(obj).find('.tabs > li').eq(idx).addClass('on').siblings().removeClass('on');
|
||||
$(obj).find('> .tabsCont').hide().eq(idx).show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
$(obj).find('.tabs > li').eq(0).addClass('on').siblings().removeClass('on');
|
||||
$(obj).find('> .tabsCont').hide().eq(0).show();
|
||||
}
|
||||
|
||||
bindEvents(obj);
|
||||
});
|
||||
|
||||
|
||||
function bindEvents(obj){
|
||||
var $this = $(obj);
|
||||
|
||||
$this.find('.tabs > li > a').on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var index = $(this).closest('li').index();
|
||||
|
||||
if($this.find('> .tabsCont').eq(index).length <= 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$(this).closest(el).find('.tabs > li').eq(index).addClass('on').siblings().removeClass('on');
|
||||
$(this).closest(el).find('> .tabsCont').hide().eq(index).show();
|
||||
|
||||
$(window).scrollTop(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 퀵모임 탭 메뉴
|
||||
function meeTabUI() {
|
||||
var el = $('.meetListArea');
|
||||
|
||||
if(el.length <= 0){
|
||||
return;
|
||||
}
|
||||
|
||||
el.each(function(idx, obj){
|
||||
if($(obj).find('.tabMeet > a').hasClass('on')){
|
||||
$(obj).find('.tabMeet > a').each(function(){
|
||||
var idx = $(this).filter('.on').index();
|
||||
if(idx >= 0){
|
||||
$(obj).find('.tabMeet > a').eq(idx).addClass('on').siblings().removeClass('on');
|
||||
$(obj).find('> .tabMeetCont').hide().eq(idx).show();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
$(obj).find('.tabMeet > a').eq(0).addClass('on').siblings().removeClass('on');
|
||||
$(obj).find('> .tabMeetCont').hide().eq(0).show();
|
||||
}
|
||||
|
||||
bindEvents(obj);
|
||||
});
|
||||
|
||||
|
||||
function bindEvents(obj){
|
||||
var $this = $(obj);
|
||||
|
||||
$this.find('.tabMeet > a').on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var index = $(this).index();
|
||||
|
||||
if($this.find('> .tabMeetCont').eq(index).length <= 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$(this).closest(el).find('.tabMeet > a').eq(index).addClass('on').siblings().removeClass('on');
|
||||
$(this).closest(el).find('> .tabMeetCont').hide().eq(index).show();
|
||||
|
||||
$(window).scrollTop(0);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
ResponsiveImagesNew();
|
||||
$(window).resize(function() {
|
||||
ResponsiveImagesNew();
|
||||
}).resize();
|
||||
accodianUI();
|
||||
tabUI();
|
||||
meeTabUI();
|
||||
|
||||
/* 요금 안내 클릭시 아래 링크안내로 가는 부분 제거
|
||||
$(document).on('click' , '#gnb a' , function(e){
|
||||
e.preventDefault();
|
||||
if(window.location.pathname=="/home"){
|
||||
$('body, html').stop().animate({
|
||||
scrollTop : $('.section.rateSimulation').offset().top - $('#header').outerHeight(true) - 30
|
||||
});
|
||||
}else{
|
||||
location.href="/home#simulation";
|
||||
}
|
||||
});
|
||||
*/
|
||||
// 조직 선택
|
||||
$(document).on('click' , '.meetOrgList a.itemHead' , function(e){
|
||||
e.preventDefault();
|
||||
|
||||
if($(this).closest('.item').hasClass('open')){
|
||||
$(this).closest('.item').removeClass('open');
|
||||
|
||||
$(this).removeClass('on');
|
||||
}
|
||||
else{
|
||||
$(this).closest('.meetOrgList').find('.item').removeClass('open');
|
||||
$(this).closest('.item').addClass('open');
|
||||
|
||||
$(this).closest('.meetOrgList').find('.itemHead').removeClass('on');
|
||||
$(this).addClass('on');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user