swipe 플러그인 touchSipe 로 변경
This commit is contained in:
1 parent
1d9953a588
commit
cb130df525
5 files changed
+94
-133
No files matched your search
Vendored
+1
@@ -0,0 +1 @@
|
||||
(function(a){if(typeof define==="function"&&define.amd&&define.amd.jQuery){define(["jquery"],a)}else{a(jQuery)}}(function(e){var o="left",n="right",d="up",v="down",c="in",w="out",l="none",r="auto",k="swipe",s="pinch",x="tap",i="doubletap",b="longtap",A="horizontal",t="vertical",h="all",q=10,f="start",j="move",g="end",p="cancel",a="ontouchstart" in window,y="TouchSwipe";var m={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"label, button, input, select, textarea, a, .noSwipe"};e.fn.swipe=function(D){var C=e(this),B=C.data(y);if(B&&typeof D==="string"){if(B[D]){return B[D].apply(this,Array.prototype.slice.call(arguments,1))}else{e.error("Method "+D+" does not exist on jQuery.swipe")}}else{if(!B&&(typeof D==="object"||!D)){return u.apply(this,arguments)}}return C};e.fn.swipe.defaults=m;e.fn.swipe.phases={PHASE_START:f,PHASE_MOVE:j,PHASE_END:g,PHASE_CANCEL:p};e.fn.swipe.directions={LEFT:o,RIGHT:n,UP:d,DOWN:v,IN:c,OUT:w};e.fn.swipe.pageScroll={NONE:l,HORIZONTAL:A,VERTICAL:t,AUTO:r};e.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:h};function u(B){if(B&&(B.allowPageScroll===undefined&&(B.swipe!==undefined||B.swipeStatus!==undefined))){B.allowPageScroll=l}if(B.click!==undefined&&B.tap===undefined){B.tap=B.click}if(!B){B={}}B=e.extend({},e.fn.swipe.defaults,B);return this.each(function(){var D=e(this);var C=D.data(y);if(!C){C=new z(this,B);D.data(y,C)}})}function z(a0,aq){var av=(a||!aq.fallbackToMouseEvents),G=av?"touchstart":"mousedown",au=av?"touchmove":"mousemove",R=av?"touchend":"mouseup",P=av?null:"mouseleave",az="touchcancel";var ac=0,aL=null,Y=0,aX=0,aV=0,D=1,am=0,aF=0,J=null;var aN=e(a0);var W="start";var T=0;var aM=null;var Q=0,aY=0,a1=0,aa=0,K=0;var aS=null;try{aN.bind(G,aJ);aN.bind(az,a5)}catch(ag){e.error("events not supported "+G+","+az+" on jQuery.swipe")}this.enable=function(){aN.bind(G,aJ);aN.bind(az,a5);return aN};this.disable=function(){aG();return aN};this.destroy=function(){aG();aN.data(y,null);return aN};this.option=function(a8,a7){if(aq[a8]!==undefined){if(a7===undefined){return aq[a8]}else{aq[a8]=a7}}else{e.error("Option "+a8+" does not exist on jQuery.swipe.options")}return null};function aJ(a9){if(ax()){return}if(e(a9.target).closest(aq.excludedElements,aN).length>0){return}var ba=a9.originalEvent?a9.originalEvent:a9;var a8,a7=a?ba.touches[0]:ba;W=f;if(a){T=ba.touches.length}else{a9.preventDefault()}ac=0;aL=null;aF=null;Y=0;aX=0;aV=0;D=1;am=0;aM=af();J=X();O();if(!a||(T===aq.fingers||aq.fingers===h)||aT()){ae(0,a7);Q=ao();if(T==2){ae(1,ba.touches[1]);aX=aV=ap(aM[0].start,aM[1].start)}if(aq.swipeStatus||aq.pinchStatus){a8=L(ba,W)}}else{a8=false}if(a8===false){W=p;L(ba,W);return a8}else{ak(true)}return null}function aZ(ba){var bd=ba.originalEvent?ba.originalEvent:ba;if(W===g||W===p||ai()){return}var a9,a8=a?bd.touches[0]:bd;var bb=aD(a8);aY=ao();if(a){T=bd.touches.length}W=j;if(T==2){if(aX==0){ae(1,bd.touches[1]);aX=aV=ap(aM[0].start,aM[1].start)}else{aD(bd.touches[1]);aV=ap(aM[0].end,aM[1].end);aF=an(aM[0].end,aM[1].end)}D=a3(aX,aV);am=Math.abs(aX-aV)}if((T===aq.fingers||aq.fingers===h)||!a||aT()){aL=aH(bb.start,bb.end);ah(ba,aL);ac=aO(bb.start,bb.end);Y=aI();aE(aL,ac);if(aq.swipeStatus||aq.pinchStatus){a9=L(bd,W)}if(!aq.triggerOnTouchEnd||aq.triggerOnTouchLeave){var a7=true;if(aq.triggerOnTouchLeave){var bc=aU(this);a7=B(bb.end,bc)}if(!aq.triggerOnTouchEnd&&a7){W=ay(j)}else{if(aq.triggerOnTouchLeave&&!a7){W=ay(g)}}if(W==p||W==g){L(bd,W)}}}else{W=p;L(bd,W)}if(a9===false){W=p;L(bd,W)}}function I(a7){var a8=a7.originalEvent;if(a){if(a8.touches.length>0){C();return true}}if(ai()){T=aa}a7.preventDefault();aY=ao();Y=aI();if(a6()){W=p;L(a8,W)}else{if(aq.triggerOnTouchEnd||(aq.triggerOnTouchEnd==false&&W===j)){W=g;L(a8,W)}else{if(!aq.triggerOnTouchEnd&&a2()){W=g;aB(a8,W,x)}else{if(W===j){W=p;L(a8,W)}}}}ak(false);return null}function a5(){T=0;aY=0;Q=0;aX=0;aV=0;D=1;O();ak(false)}function H(a7){var a8=a7.originalEvent;if(aq.triggerOnTouchLeave){W=ay(g);L(a8,W)}}function aG(){aN.unbind(G,aJ);aN.unbind(az,a5);aN.unbind(au,aZ);aN.unbind(R,I);if(P){aN.unbind(P,H)}ak(false)}function ay(bb){var ba=bb;var a9=aw();var a8=aj();var a7=a6();if(!a9||a7){ba=p}else{if(a8&&bb==j&&(!aq.triggerOnTouchEnd||aq.triggerOnTouchLeave)){ba=g}else{if(!a8&&bb==g&&aq.triggerOnTouchLeave){ba=p}}}return ba}function L(a9,a7){var a8=undefined;if(F()||S()){a8=aB(a9,a7,k)}else{if((M()||aT())&&a8!==false){a8=aB(a9,a7,s)}}if(aC()&&a8!==false){a8=aB(a9,a7,i)}else{if(al()&&a8!==false){a8=aB(a9,a7,b)}else{if(ad()&&a8!==false){a8=aB(a9,a7,x)}}}if(a7===p){a5(a9)}if(a7===g){if(a){if(a9.touches.length==0){a5(a9)}}else{a5(a9)}}return a8}function aB(bLine truncated
|
||||
Vendored
-10
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
|
||||
* Common usage: wipe images (left and right to show the previous or next image)
|
||||
*
|
||||
* @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
|
||||
* @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems)
|
||||
* @version 1.1 (1st September 2010) - support wipe up and wipe down
|
||||
* @version 1.0 (15th July 2010)
|
||||
*/
|
||||
(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery);
|
||||
@@ -117,8 +117,6 @@
|
||||
if(check_animated())
|
||||
return;
|
||||
|
||||
$(window).on("touchmove", blockMove);
|
||||
|
||||
idx = $slides.index($slides.filter("."+cfg.active_class));
|
||||
next = (idx + 1) % count;
|
||||
|
||||
@@ -151,8 +149,6 @@
|
||||
$tabs.eq((next + 1) % count).addClass("tab_listed").css("left", pos_right+"px");
|
||||
}
|
||||
|
||||
$(window).off("touchmove", blockMove);
|
||||
|
||||
$wrap.height(next_height);
|
||||
$tabs.eq(next).addClass(cfg.tab_active);
|
||||
}
|
||||
@@ -170,8 +166,6 @@
|
||||
if(check_animated())
|
||||
return;
|
||||
|
||||
$(window).on("touchmove", blockMove);
|
||||
|
||||
idx = $slides.index($slides.filter("."+cfg.active_class));
|
||||
next = idx - 1;
|
||||
if(next < 0)
|
||||
@@ -206,8 +200,6 @@
|
||||
$tabs.eq((next + 1) % count).addClass("tab_listed").css("left", pos_right+"px");
|
||||
}
|
||||
|
||||
$(window).off("touchmove", blockMove);
|
||||
|
||||
$wrap.height(next_height);
|
||||
$tabs.eq(next).addClass(cfg.tab_active);
|
||||
}
|
||||
@@ -244,11 +236,6 @@
|
||||
swipe_left();
|
||||
}
|
||||
|
||||
function blockMove(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
$(window).on("load", function(e) {
|
||||
swipe_init();
|
||||
});
|
||||
@@ -259,12 +246,20 @@
|
||||
|
||||
|
||||
// swipe event
|
||||
$(window).touchwipe({
|
||||
wipeLeft: function() { swipe_left(); },
|
||||
wipeRight: function() { swipe_right(); },
|
||||
min_move_x: 20,
|
||||
min_move_y: 20,
|
||||
preventDefaultEvents: false
|
||||
this.swipe({
|
||||
swipe: function(event, direction, duration, fingerCount) {
|
||||
switch(direction) {
|
||||
case "left":
|
||||
swipe_left();
|
||||
break;
|
||||
case "right":
|
||||
swipe_right();
|
||||
break;
|
||||
}
|
||||
},
|
||||
threshold: 50,
|
||||
excludedElements:".noSwipe",
|
||||
allowPageScroll:"vertical"
|
||||
});
|
||||
}
|
||||
}(jQuery));
|
||||
@@ -6,8 +6,8 @@ define("_INDEX_", TRUE);
|
||||
include_once(G5_MSHOP_PATH.'/shop.head.php');
|
||||
?>
|
||||
|
||||
<script src="<?php echo G5_JS_URL; ?>/jquery.touchwipe.min.js"></script>
|
||||
<script src="<?php echo G5_JS_URL; ?>/jquery.slideview.js"></script>
|
||||
<script src="<?php echo G5_JS_URL; ?>/jquery.touchSwipe.min.js"></script>
|
||||
<script src="<?php echo G5_JS_URL; ?>/shop.mobile.main.js"></script>
|
||||
|
||||
<div id="sidx">
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" href="<?php echo G5_MSHOP_SKIN_URL; ?>/style.css">
|
||||
<script src="<?php echo G5_JS_URL; ?>/jquery.touchwipe.min.js"></script>
|
||||
<script src="<?php echo G5_JS_URL; ?>/jquery.touchSwipe.min.js"></script>
|
||||
|
||||
<form name="fitem" action="<?php echo $action_url; ?>" method="post" onsubmit="return fitem_submit(this);">
|
||||
<input type="hidden" name="it_id[]" value="<?php echo $it['it_id']; ?>">
|
||||
@@ -384,111 +384,86 @@ $(function(){
|
||||
});
|
||||
|
||||
// 이전 다음상품 swipe
|
||||
$(window).touchwipe({
|
||||
wipeLeft: function() {
|
||||
<?php if($next_href) { ?>
|
||||
if($("#loading_message").length > 0)
|
||||
return;
|
||||
|
||||
var content = $("#container").clone()
|
||||
.find("#form_btn_layer").remove()
|
||||
.end().find(".sit_pvi_btn").remove()
|
||||
.end().html();
|
||||
var pos = $("#container").position();
|
||||
var width = $("#container").width();
|
||||
var height = $("#container").height();
|
||||
var pad_top = $("#container").css("padding-top");
|
||||
var duration = 500;
|
||||
|
||||
// 로딩 레이어
|
||||
load_message();
|
||||
|
||||
$("#container")
|
||||
.css({
|
||||
width: width+"px",
|
||||
height: height+"px"
|
||||
})
|
||||
.before("<div id=\"container_clone\">"+content+"</div>")
|
||||
.find("*:visible").hide();
|
||||
|
||||
$("#container_clone")
|
||||
.css({
|
||||
display: "block",
|
||||
width: width+"px",
|
||||
height: height+"px",
|
||||
position: "absolute",
|
||||
top: pos.top+"px",
|
||||
left: pos.left+"px",
|
||||
paddingTop: pad_top
|
||||
})
|
||||
.animate(
|
||||
{ left: "-="+width+"px" }, duration,
|
||||
function() {
|
||||
$("#container_clone").remove();
|
||||
var str = '<?php echo $next_href; ?>';
|
||||
var href = str.match(/https?:\/{2}[^\"]+/gi);
|
||||
document.location.href = href[0];
|
||||
}
|
||||
);
|
||||
<?php } else { ?>
|
||||
alert("다음 상품이 없습니다.");
|
||||
<?php } ?>
|
||||
$("#container").swipe({
|
||||
swipe: function(event, direction) {
|
||||
switch(direction) {
|
||||
case "left":
|
||||
<?php if($next_href) { ?>
|
||||
content_move(direction);
|
||||
<?php } else { ?>
|
||||
alert("다음 상품이 없습니다.");
|
||||
<?php } ?>
|
||||
break;
|
||||
case "right":
|
||||
<?php if($prev_href) { ?>
|
||||
content_move(direction);
|
||||
<?php } else { ?>
|
||||
alert("이전 상품이 없습니다.");
|
||||
<?php } ?>
|
||||
break;
|
||||
}
|
||||
},
|
||||
wipeRight: function() {
|
||||
<?php if($prev_href) { ?>
|
||||
if($("#loading_message").length > 0)
|
||||
return;
|
||||
|
||||
var content = $("#container").clone()
|
||||
.find("#form_btn_layer").remove()
|
||||
.end().find(".sit_pvi_btn").remove()
|
||||
.end().html();
|
||||
var pos = $("#container").position();
|
||||
var width = $("#container").width();
|
||||
var height = $("#container").height();
|
||||
var pad_top = $("#container").css("padding-top");
|
||||
var duration = 500;
|
||||
|
||||
// 로딩 레이어
|
||||
load_message();
|
||||
|
||||
$("#container")
|
||||
.css({
|
||||
width: width+"px",
|
||||
height: height+"px"
|
||||
})
|
||||
.before("<div id=\"container_clone\">"+content+"</div>")
|
||||
.find("*:visible").hide();
|
||||
|
||||
$("#container_clone")
|
||||
.css({
|
||||
display: "block",
|
||||
width: width+"px",
|
||||
height: height+"px",
|
||||
position: "absolute",
|
||||
top: pos.top+"px",
|
||||
left: pos.left+"px",
|
||||
zIndex: "1000",
|
||||
paddingTop: pad_top
|
||||
})
|
||||
.animate(
|
||||
{ left: "+="+width+"px" }, duration,
|
||||
function() {
|
||||
$("#container_clone").remove();
|
||||
var str = '<?php echo $prev_href; ?>';
|
||||
var href = str.match(/https?:\/{2}[^\"]+/gi);
|
||||
document.location.href = href[0];
|
||||
}
|
||||
);
|
||||
<?php } else { ?>
|
||||
alert("이전 상품이 없습니다.");
|
||||
<?php } ?>
|
||||
},
|
||||
min_move_x: 50,
|
||||
preventDefaultEvents: false
|
||||
threshold: 50,
|
||||
excludedElements:".noSwipe",
|
||||
allowPageScroll:"vertical"
|
||||
});
|
||||
});
|
||||
|
||||
function content_move(direction)
|
||||
{
|
||||
var content = $("#container").clone()
|
||||
.find("#form_btn_layer").remove()
|
||||
.end().find(".sit_pvi_btn").remove()
|
||||
.end().html();
|
||||
var pos = $("#container").position();
|
||||
var width = $("#container").width();
|
||||
var height = $("#container").height();
|
||||
var pad_top = $("#container").css("padding-top");
|
||||
var next_href = '<?php echo $next_href; ?>';
|
||||
var prev_href = '<?php echo $prev_href; ?>';
|
||||
var str, left_value;
|
||||
var duration = 500;
|
||||
|
||||
if(direction == "left") {
|
||||
str = next_href;
|
||||
left_value = "-="+width+"px";
|
||||
} else {
|
||||
str = prev_href;
|
||||
left_value = "+="+width+"px";
|
||||
}
|
||||
|
||||
// 로딩 레이어
|
||||
load_message();
|
||||
|
||||
$("#container")
|
||||
.css({
|
||||
width: width+"px",
|
||||
height: height+"px"
|
||||
})
|
||||
.before("<div id=\"container_clone\">"+content+"</div>")
|
||||
.find("*:visible").hide();
|
||||
|
||||
$("#container_clone")
|
||||
.css({
|
||||
display: "block",
|
||||
width: width+"px",
|
||||
height: height+"px",
|
||||
position: "absolute",
|
||||
top: pos.top+"px",
|
||||
left: pos.left+"px",
|
||||
zIndex: "1000",
|
||||
paddingTop: pad_top
|
||||
})
|
||||
.animate(
|
||||
{ left: left_value }, duration,
|
||||
function() {
|
||||
$("#container_clone").remove();
|
||||
var href = str.match(/https?:\/{2}[^\"]+/gi);
|
||||
document.location.href = href[0];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function load_message()
|
||||
{
|
||||
var w = $(window).width();
|
||||
|
||||
Reference in new issue
Block a user