[jquery] ๋””๋ฐ”์ด์Šค ์ •๋ณด๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•œ swipe

2014. 3. 4. 11:52ยทLanguages/JavaScript

<!doctype html>
<html lang="kr">
 <head>
	<meta charset="UTF-8" />                                                                                                   
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"/>
	<title>Document</title>
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
	<script type="text/javascript" src="//code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
	<script type="text/javascript">
		var device_width = 0;	//์ ‘์† ๋””๋ฐ”์ด์Šค width๊ฐ’์„ ์ €์žฅํ•˜๋Š” ๋ณ€์ˆ˜
		var device_height = 0;	//์ ‘์† ๋””๋ฐ”์ด์Šค height๊ฐ’์„ ์ €์žฅํ•˜๋Š” ๋ณ€์ˆ˜
		var width_position = 0;
		var height_position = 0;
		var tmpScrollTop_Y = 0;

		//๋””๋ฐ”์ด์Šค ์‚ฌ์ด์ฆˆ๋ฅผ ๊ตฌํ•ด์„œ ๋ณ€์ˆ˜์— ์ €์žฅ
		function device_size(){
			 device_width = viewportSize().width;
			 device_height = viewportSize().height;
			 tmpScrollTop_Y = device_height * 4;
		}

		function viewportSize(){
			var size_div = document.createElement( "div" );
		 
			size_div.style.cssText = "position:fixed;top:0;left:0;bottom:0;right:0;";
			document.documentElement.insertBefore(size_div, document.documentElement.firstChild );
		 
			var size_res = {width:size_div.offsetWidth, height:size_div.offsetHeight };
			document.documentElement.removeChild(size_div);
		 
			return size_res;
		}
                /* swipeup */
		$('.slide_box').on('swipeup',function(){
			if($(".slide_box > div:first-child").css("top") != "0px"){
				$('.slide_box .school_layout div').parents('.school_layout').animate({"top":'-='+device_height+''},"500");
			}else{
				return;
			}
		});
		
		
		/* swipedown */
		$('.slide_box').on('swipedown',function(){
			if($(".slide_box > div:first-child").css("top") != tmpScrollTop_Y + "px"){
				$('.slide_box .school_layout div').parents('.school_layout').animate({"top":'+='+device_height+''},"500");
			}else{
				return;
			}
		});
		
		/* swipeleft */
		$('.slide_box').on('swipeleft',function(){
			if($(".slide_box > div:last-child").css("left") != "0px"){
				$('.slide_box .school_layout').animate({"left":'-='+device_width+''},"500");
			}else{
				return;
			}
		});

		/* swiperight */
		$('.slide_box').on('swiperight',function(){
			if($(".slide_box > div:first-child").css("left") != "0px"){
				$('.slide_box .school_layout').animate({"left":'+='+device_width+''},"500");
			}else{
				return;
			}
		});

		function drawDiv(){
			var str = '';

			for(var i=0; i < 5; i++ ){
				str += '<div style="position:absolute;top:0px;left:'+width_position+'px;width:100%;">';
				width_position += device_width;

				height_position -= device_height;
				pasteTxt += '<div style="position:absolute;top:'+height_position+'px;left:0;width:100%;">';
			}

			$('#divName').html(str);
		}

	</script>
 </head>
 <body>
  
 </body>
</html>
  
728x90
์ €์ž‘์žํ‘œ์‹œ ๋น„์˜๋ฆฌ ๋ณ€๊ฒฝ๊ธˆ์ง€
'Languages/JavaScript' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€
  • javascript XMLHttpRequest Object ์˜ˆ์ œ
  • [javascript] select box ๋…„์›”์ผ selected
  • [javascript] select box์˜ value selected
  • [jquery]layer popup
์ง€๋‹ˆ๐Ÿงž‍โ™‚๏ธ๐Ÿฅญ
์ง€๋‹ˆ๐Ÿงž‍โ™‚๏ธ๐Ÿฅญ
์ผ์ƒ, ๊ฒŒ์ž„, ๋ง›์ง‘, ์—ฌํ–‰, ๊ฐœ๋ฐœ, IT ๋ธ”๋กœ๊ทธ๐Ÿงž
  • ์ง€๋‹ˆ๐Ÿงž‍โ™‚๏ธ๐Ÿฅญ
    ์š”์ˆ  ๋žจํ”„๐Ÿซ–
    ์ง€๋‹ˆ๐Ÿงž‍โ™‚๏ธ๐Ÿฅญ
  • ์ „์ฒด
    ์˜ค๋Š˜
    ์–ด์ œ
    • All (549)
      • Languages (57)
        • JAVA (13)
        • JSP (1)
        • C_C++ (4)
        • Html (3)
        • CSS (1)
        • JavaScript (18)
        • Python (3)
        • Kotlin (13)
        • TypeScript (1)
      • Framework (14)
        • spring (11)
        • jstl (1)
        • angular (2)
      • Tool (28)
        • Eclipse (5)
        • vsCode (3)
        • scrcpy (2)
        • Git (1)
        • IntelliJ (6)
        • Visual-studio (1)
        • UML (1)
        • Gradle (8)
      • DB (6)
        • Oracle (1)
        • MySql (3)
        • Mongo (2)
      • OS (14)
        • Linux (2)
        • Windows (12)
      • Server (8)
        • Tomcat (1)
        • Apache (1)
        • Node.js (6)
      • Programmings (25)
        • Design Pattern (2)
        • Funny (20)
        • Algorithms (3)
      • Cloud (8)
        • Docker (1)
        • Kubernetes (4)
        • Istio (1)
        • ArgoCD (2)
      • IT (5)
        • gRPC (3)
        • RESTful (3)
        • Web UI (5)
        • AI (4)
      • Book (6)
      • TIP (187)
      • Life (53)
      • Game (83)
      • Storage (22)
      • ์‹๋‹น (15)
  • ๋ธ”๋กœ๊ทธ ๋ฉ”๋‰ด

    • ํ™ˆ
    • ํƒœ๊ทธ
    • ๋ฐฉ๋ช…๋ก
    • ์‚ฌ์ดํŠธ๋งต
    • RSS
    • ๊ธฐํƒ€ ์†Œ๋“
  • ๋งํฌ

    • ๊ตฌ๊ธ€
    • ๋„ค์ด๋ฒ„
    • ์ •๋ถ€24
    • Spring Framework ๋ฆด๋ฆฌ์ฆˆ ๋…ธํŠธ
    • Kotlin ๋ฆด๋ฆฌ์ฆˆ ๋…ธํŠธ
    • ์นด์นด์˜ค ์• ๋“œํ•
    • ๋ธ”๋กœ๊ทธ ์‚ฌ์ดํŠธ๋งต
    • ๋ธ”๋กœ๊ทธ RSS
  • ๊ณต์ง€์‚ฌํ•ญ

    • ์•ˆ๋…•ํ•˜์„ธ์š”
  • ์ธ๊ธฐ ๊ธ€

  • ํƒœ๊ทธ

    ๋‰ด์Šค
    ํ•œ๋ˆˆ์— ๋ณด๋Š” ์˜ค๋Š˜์˜ ๋‰ด์Šค
    ๋ชฌ์Šคํ„ฐํ—Œํ„ฐ์™€์ผ์ฆˆ
    ๋ฐ์ผ๋ฆฌ ๋‰ด์Šค
    ๋ชฌ์Šคํ„ฐํ—Œํ„ฐ๋‚˜์šฐ
    ๋ธŒ๋ฆฌํ•‘
    ์˜ค๋Š˜์˜๋‰ด์Šค
    ํƒœ๊ตญ
    ๋‰ด์Šค ๋ธŒ๋ฆฌํ•‘
    ํ€˜์ŠคํŠธ
  • ์ตœ๊ทผ ๋Œ“๊ธ€

  • ์ตœ๊ทผ ๊ธ€

  • hELLOยท Designed By์ •์ƒ์šฐ.v4.10.3
์ง€๋‹ˆ๐Ÿงž‍โ™‚๏ธ๐Ÿฅญ
[jquery] ๋””๋ฐ”์ด์Šค ์ •๋ณด๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•œ swipe
์ƒ๋‹จ์œผ๋กœ

ํ‹ฐ์Šคํ† ๋ฆฌํˆด๋ฐ”