/* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright © 2008 George McGinley Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ // t: current time, b: begInnIng value, c: change In value, d: duration jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend( jQuery.easing, { def: 'easeOutQuad', swing: function (x, t, b, c, d) { return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); /* * * TERMS OF USE - EASING EQUATIONS * * Open source under the BSD License. * * Copyright © 2001 Robert Penner * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ ;(function($, exports, undefined){ "use strict"; var commonjs = { eventClick : function (event) { 'use strict'; if(event.preventDefault) { event.preventDefault(); //FF } else { event.returnValue = false; //IE } }, resizeModule : function (fn){ "use strict"; var setID; $(window).resize(function(){ window.clearTimeout(setID); setID = window.setTimeout(function(){ if(typeof(fn) == 'function')fn(); },10); }); }, mobilecheck : function() { var check = false; (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); return check; } }; var desktopEvents = ['mousedown', 'mousemove', 'mouseup']; var swipeslide = false; if(commonjs.mobilecheck() && ('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch || navigator.maxTouchPoints > 0 || window.navigator.msMaxTouchPoints > 0)){ var touchsupport = true; }else{ var touchsupport = false; } var touchEvents = { touchStart: touchsupport ? 'touchstart' : desktopEvents[0], touchMove: touchsupport ? 'touchmove' : desktopEvents[1], touchEnd: touchsupport ? 'touchend' : desktopEvents[2] }; var sint; $.fn.viClear = function(){ window.clearInterval(sint); } if(!$.fn.viSimpleSlider){ var settings = { ease : 'swing', indicate : true, arrow : true, autoPlay : false, autoTime : 3000, speed : 800, cut : 0, loop : true, mobileSwipe : true, desktopSwipe : true } } //if $.fn.viSimpleSlider = function(option){ var $this = $(this), setVal = $.type(option) == 'object' ? $.extend({},settings,option) : settings; $this.find('>ul').addClass('visimpleslider-sliders') var $WrapUl = $this.find('>ul.visimpleslider-sliders'); var thiscurrent = 0, defaultW = $this.width(), maxSlide = $WrapUl.find('>li').length, Xposition = [], orgImg = [], mImg = [], dragging = false, motioning = false, slideWrapH = 0, slideWrapX, x_origine, y_origine, x_new, y_new, ratio, intTime = setVal.autoTime; $this.addClass('viSimpleSlider'); var keypress = false; if(setVal.desktopSwipe){ swipeslide = true; }else{ swipeslide = false; if(touchsupport && setVal.mobileSwipe) swipeslide = true; } var SimpleSlider = { /*********************************************************************************** 1. ½½¶óÀÌµå »ý¼º ************/ mkSlide : function(e){ $WrapUl.find('>li').each(function(i){ var thisSlide = $(this); var links = thisSlide.data('link'), target = thisSlide.data('target'); thisSlide.append('').addClass('slide'); if(setVal.desktopSwipe){ thisSlide.find('.clickDiv').mousedown(function(e){ if(!dragging && !motioning){ keypress = true; } commonjs.eventClick(e); }); thisSlide.find('.clickDiv').mouseup(function(e){ if(keypress && !dragging && !motioning){ if(links && target == "_blank")window.open(links); else if(links && target !== "_blank") location.href = links; } commonjs.eventClick(e); }) thisSlide.find('.clickDiv').on('click', function(e){ if(!dragging && !motioning){ if(links && target == "_blank")window.open(links); else if(links && target !== "_blank") location.href = links; } commonjs.eventClick(e); }); }else{ thisSlide.find('.clickDiv').on('click', function(e){ if(!dragging && !motioning){ if(links && target == "_blank")window.open(links); else if(links && target !== "_blank") location.href = links; } commonjs.eventClick(e); }); } }); }, /*********************************************************************************** 2. »ý¼ºÇÑ ½½¶óÀ̵å Á¤·Ä ************/ sortSlide : function(e){ function Imgload(i){ var thisSlide = $WrapUl.find('>li').eq(i); var thisSlideImg = thisSlide.find('>img'); var img = new Image(); img.onload = function(){ // console.log('load comp'); ratio = img.height/img.width; setSlide(thisSlide, i); }; img.error = function(){ // console.log('load errer'); setSlide(thisSlide, i); }; img.src = thisSlideImg.attr('src'); } Imgload(0); function setSlide(ele, Num){ var $thisLi = ele; Xposition[Num] = defaultW * Num; // console.log('Xposition ' + Xposition[Num]) $thisLi.css({ 'position' : 'absolute', 'display' : 'block', 'width' : defaultW, 'left' : Xposition[Num], 'z-index' : '10' }); if(slideWrapH <= 0 && Num == 0){ slideWrapH = Math.floor(defaultW*ratio-setVal.cut); $WrapUl.height(slideWrapH); } if(Num < maxSlide-1)Imgload(Num+1); //¹Ýº¹ ½Ã۱â } //setSlide }, /*********************************************************************************** 3. ¾ÕµÚ ½½¶óÀÌµå º¹»ç ************/ cloneslide : function(){ Xposition[maxSlide] = defaultW*(maxSlide); Xposition[maxSlide+1] = 0-defaultW; $WrapUl.find('>li').eq(0).clone().appendTo($WrapUl).addClass('clone last').css({ 'left' : Xposition[maxSlide], 'width' : defaultW, 'z-index' : '9' }); $WrapUl.find('>li').eq(maxSlide-1).clone().appendTo($WrapUl).addClass('clone first').css({ 'left' : Xposition[maxSlide+1], 'width' : defaultW, 'z-index' : '9' }); }, /*********************************************************************************** (¿É¼Ç) ÀÚµ¿ ½½¶óÀ̵å ************/ autoSlide : function(){ window.clearInterval(sint); sint = window.setInterval(function(){ if(thiscurrent < maxSlide && setVal.loop){ thiscurrent = thiscurrent + 1; slidefunc.slideMotion(thiscurrent); }else if(thiscurrent >= maxSlide && setVal.loop){ //¸¶Áö¸·¿¡ µµÂøÇßÀ¸¸é À̾îÁö°Ô ÇÏ·Á´Â ÄÚµå thiscurrent = maxSlide-1; slidefunc.slideMotion(thiscurrent); }else if(thiscurrent < maxSlide-1 && !setVal.loop){ thiscurrent = thiscurrent + 1; slidefunc.slideMotion(thiscurrent); }else if(thiscurrent >= maxSlide-1 && !setVal.loop){ window.clearInterval(sint); } },intTime); }, /*********************************************************************************** ±âº» CSS ¼ÂÆÃ ************/ setCss : function(e){ $this.css({ 'overflow' : 'hidden', 'display' : 'block', 'position' : 'relative' }); $WrapUl.css({ 'position': 'relative', 'height' : '100%', '-webkit-touch-callout' : 'none', '-webkit-user-select' : 'none', '-khtml-user-select' : 'none', '-moz-user-select' : 'none', '-ms-user-select' : 'none', 'user-select' : 'none' }); $WrapUl.find('>li').css({ 'width' : defaultW, 'display': 'block', 'position': 'absolute' }) .find('>img').css({ 'width' : '100%' }); } }; var makeDepth = { /*********************************************************************************** (¿É¼Ç) ÀεðÄÉÀÌÆ® »ý¼º ************/ mkIndicate : function(e){ $('
').appendTo($this).css({ 'position': 'absolute' }); for(var i = 0; i < maxSlide; i++){ $('').appendTo($this.find('div.indicate')) .on('click',function(e){ var thisIndex = $this.find('div.indicate').find('a').index($(this)); thiscurrent = thisIndex; slidefunc.slideMotion(thiscurrent); $(this).addClass('active').siblings().removeClass('active'); commonjs.eventClick(e); }); $this.find('div.indicate').find('>a').eq(0).addClass('active'); } //for }, /*********************************************************************************** (¿É¼Ç) È»ìÇ¥ ¸¸µé±â ************/ mkArrow : function(e){ if($this.find('a.arrowBtn.prev').length == 0)$('').appendTo($this).addClass('arrowBtn prev'); if($this.find('a.arrowBtn.next').length == 0)$('').appendTo($this).addClass('arrowBtn next'); $this.find('a.arrowBtn').each(function(BtnIndex){ var $thisBtn = $(this); $thisBtn.on('click', function(e){ // console.log(thiscurrent) if(!motioning){ if($thisBtn.hasClass('prev') && thiscurrent > -1){ if(!setVal.loop && thiscurrent == 0){ //¹Ýº¹Àº ¾ÈÇÔ ¼³Á¤ / ¸Ç óÀ½±îÁö °¬´Âµ¥ ÀÌÀü Ŭ¸¯ÇßÀ» ¶§ }else{ thiscurrent = thiscurrent - 1; slidefunc.slideMotion(thiscurrent); } }else if($thisBtn.hasClass('prev') && thiscurrent == -1){ slidefunc.slideMotion(thiscurrent); } //if ÀÌÀü ¹öư Ŭ¸¯ if($thisBtn.hasClass('next') && thiscurrent < maxSlide ){ if(!setVal.loop && thiscurrent == maxSlide-1){ //¹Ýº¹Àº ¾ÈÇÔ ¼³Á¤ / ¸Ç ¸¶Áö¸·±îÁö °¬´Âµ¥ ´ÙÀ½ Ŭ¸¯ÇßÀ» ¶§ }else{ thiscurrent = thiscurrent + 1; slidefunc.slideMotion(thiscurrent); } }else if($thisBtn.hasClass('next') && thiscurrent == maxSlide){ slidefunc.slideMotion(thiscurrent); } //if ´ÙÀ½ ¹öư Ŭ¸¯ } commonjs.eventClick(e); }); }); //each } } /*********************************************************************************** ¸®»çÀÌÁî ¸ðµâ ½ÇÇà ************/ commonjs.resizeModule(function(){ defaultW = $this.width(); Xposition = []; SimpleSlider.setCss(); $WrapUl.find('>li').each(function(index){ Xposition[index] = defaultW * index; $(this).css('left',Xposition[index]); if(setVal.loop && index == $WrapUl.find('>li').length-1)$(this).css('left',0-Xposition[1]); }) //each motioning = false; $WrapUl.stop().css('left',-thiscurrent*defaultW); slideWrapH = Math.floor(defaultW*ratio-setVal.cut); $WrapUl.height(slideWrapH); }); var slidefunc = { /*********************************************************************************** ½½¶óÀÌµå ¸ð¼Ç ************/ slideMotion : function(targetIndex){ // console.log('À̵¿ ' + targetIndex) /* À̾îÁö±â ¸¸µå´Â Áß */ var _ele = $WrapUl, _elewidth = defaultW; if(targetIndex == maxSlide){ // ¸¶Áö¸· Àå¸é¿¡¼ óÀ½À¸·Î µ¹¾Æ°¡±â À§ÇÑ ¸ð¼Ç thiscurrent = 0; motioning = true; $WrapUl.find('>li').eq(thiscurrent).addClass('active').siblings().removeClass('active'); $WrapUl.stop().animate({ 'left' : -(Xposition[maxSlide-1] + defaultW) },setVal.speed,setVal.ease,function(){ _ele.css('left',0); motioning = false; dragging = false; }); }else if(targetIndex == -1){ thiscurrent = maxSlide-1; motioning = true; $WrapUl.find('>li').eq(thiscurrent).addClass('active').siblings().removeClass('active'); $WrapUl.stop().animate({ 'left' : $WrapUl.find('li').eq(maxSlide-1).width() },setVal.speed,setVal.ease,function(){ _ele.css('left',-Xposition[maxSlide-1]); motioning = false; dragging = false; }); }else{ motioning = true; $WrapUl.find('>li').eq(thiscurrent).addClass('active').siblings().removeClass('active'); $WrapUl.stop().animate({ 'left' : -targetIndex*_elewidth },setVal.speed,setVal.ease,function(){ motioning = false; dragging = false; }); } if(settings.indicate && maxSlide > 1){ $this.find('.indicate').find('>a').eq(thiscurrent).addClass('active').siblings().removeClass('active'); } if(!setVal.loop && setVal.arrow && thiscurrent == 0){ $this.find('a.arrowBtn.prev').addClass('locked'); }else if(!setVal.loop && setVal.arrow && thiscurrent > 0){ $this.find('a.arrowBtn.prev').removeClass('locked'); } if(!setVal.loop && setVal.arrow && thiscurrent == maxSlide-1){ $this.find('a.arrowBtn.next').addClass('locked'); }else if(!setVal.loop && setVal.arrow && thiscurrent < maxSlide-1){ $this.find('a.arrowBtn.next').removeClass('locked'); } }, //slideMotion /*********************************************************************************** µå·¡±ë ¾×¼Ç ************/ dragAction : function(event,num){ keypress = false; window.clearInterval(sint); //ÅÍÄ¡ÇßÀ» ¶§´Â ÀÎÅ͹úÀÌ ¸ØÃç¾ßÇÔ if(num > 0){ //¿òÁ÷ÀÓÀÌ + ¹ß»ýÇÑ´Ù¸é if(setVal.loop || (!setVal.loop && thiscurrent < maxSlide-1)){ $WrapUl.css({ 'left' : slideWrapX - num }); } commonjs.eventClick(event); }else if(num < 0){ //¿òÁ÷ÀÓÀÌ - ¹ß»ýÇÑ´Ù¸é if(setVal.loop || (!setVal.loop && thiscurrent > 0)){ $WrapUl.css({ 'left' : slideWrapX - num }); } commonjs.eventClick(event); }else{ //commonjs.eventClick(event); } //if }, /*********************************************************************************** µå·¡±× ³¡ ************/ dragEnd : function(num){ // console.log('µå·¡±×¿£µå') $WrapUl.removeClass('keydown keymove'); if(setVal.autoPlay){ SimpleSlider.autoSlide(); }; //ÀÎÅ͹ú ¿É¼ÇÀÌ µÇ¾îÀÖ´Ù¸é ´Ù½Ã ÀÎÅ͹úµÊ if(num !== 0){ //À̵¿¹ß»ý µÊ if(num > $this.width()*0.1){ if(setVal.loop || (!setVal.loop && thiscurrent < maxSlide-1)){ dragging = false; x_new = 0; thiscurrent = thiscurrent + 1; if(thiscurrent <= maxSlide && !motioning){ //¸ð¼Å´×ÁßÀÌ ¾Æ´Ï°í, ÇöÀç ¸¶Áö¸·ÀÌ ¾Æ´Ñ »óÅ slidefunc.slideMotion(thiscurrent); } } //if ´ÙÀ½ ¹öư Ŭ¸¯ }else if(num < $this.width()*-0.1){ if(setVal.loop || (!setVal.loop && thiscurrent > 0)){ dragging = false; x_new = 0; thiscurrent = thiscurrent - 1; // console.log(thiscurrent) if(thiscurrent >= -1 && !motioning){ slidefunc.slideMotion(thiscurrent); } } }else{ dragging = true; x_new = 0; slidefunc.slideMotion(thiscurrent); } //if } //if } //if }; //var slidefunc /*********************************************************************************** ÅÍÄ¡ / ¸¶¿ì½º ÀÎÅÍ·º¼Ç ************/ function getHeightNum(){ if(touchsupport){ return 10; }else{ return 100; } } function touchStartBind(event){ var touch = touchsupport ? event.originalEvent.touches[0] || event.originalEvent.changedTouches[0] : event; var x_origine = touch.pageX; var y_origine = touch.pageY; if(!motioning && !dragging && maxSlide > 1){ window.clearInterval(sint); $WrapUl.addClass('keydown'); slideWrapX = $WrapUl.position().left; $this.bind(touchEvents.touchMove, function(event){ var touch2 = touchsupport ? event.originalEvent.touches[0] || event.originalEvent.changedTouches[0] : event; x_new = x_origine - touch2.pageX; y_new = y_origine - touch2.pageY; if(Math.abs(y_new) > getHeightNum() || (Math.abs(x_new) < Math.abs(y_new))){ $this.trigger(touchEvents.touchEnd); dragging = false; slidefunc.dragEnd(x_new); }else{ window.clearInterval(sint); $WrapUl.addClass('keymove'); slidefunc.dragAction(event,x_new); commonjs.eventClick(event); } }); //touchmove } //if } if(swipeslide){ $this.bind(touchEvents.touchStart, function(event){ touchStartBind(event); }); $this.bind(touchEvents.touchEnd, function(event){ $(document).unbind(touchEvents.touchMove); $this.unbind(touchEvents.touchMove); if(!dragging)slidefunc.dragEnd(x_new); }); $(document).bind(touchEvents.touchEnd, function(event){ if($WrapUl.hasClass('keymove')){ dragging = false; slidefunc.dragEnd(x_new); commonjs.eventClick(event); }else{ // console.log('³¡') } $this.unbind(touchEvents.touchMove); $(document).unbind(touchEvents.touchMove); }); } //swipeslide (function init(){ SimpleSlider.mkSlide(); //½½¶óÀÌµå ¸¸µé±â SimpleSlider.sortSlide(); //»ý¼ºµÈ ½½¶óÀ̵å Á¤·Ä if(maxSlide > 1 && setVal.loop)SimpleSlider.cloneslide(); //À̾îÁö°Ô ÇÏ·Á°í ½½¶óÀ̵åÀÇ ¾Õ°ú µÚ ¿¤¸®¸ÕÆ®¸¦ º¹»çÇØ¼ ¾çÂÊ ¹Ý´ëÂÊ¿¡ ¹èÄ¡ÇÔ SimpleSlider.setCss(); if(setVal.arrow && maxSlide > 1)makeDepth.mkArrow(); //(¿É¼Ç) È»ìÇ¥ ¸¸µé±â ½ÇÇà if(setVal.indicate && maxSlide > 1)makeDepth.mkIndicate(); //(¿É¼Ç) ÀεðÄÉÀÌÆ® »ý¼º ½ÇÇà if(setVal.autoPlay && maxSlide > 1){ SimpleSlider.autoSlide(); $this.hover(function(e){ window.clearInterval(sint); },function(e){ SimpleSlider.autoSlide(); }); } //(¿É¼Ç) ÀÚµ¿ ½½¶óÀÌµå ½ÇÇà $WrapUl.find('>li').eq(0).addClass('active').siblings().removeClass('active'); if(!setVal.loop)$this.find('a.arrowBtn.prev').addClass('locked'); })(); } })(window.jQuery, window);