1/*! 2 * animate-sgn-1.3.js 3 * http://www.sangonana.jp/ 4 * 5 * Copyright 2017, 357 CO.,LTD. 6 * æ ªå¼ä¼ç¤¾357 7 * 8 */ 9 10function animateSgn(option){ 11 /* 12 selector : ã¢ãã¡ã¼ã·ã§ã³è¦ç´ ã®ã»ã¬ã¯ã¿ 13 baseLine : çºç«ã©ã¤ã³ 14 1.0 : ã¦ã£ã³ãã¦æ å æä¸é¨(表示åã«å ¥ã£ãç¬é) 15 0.5 : ã¦ã£ã³ãã¦æ å ä¸å¤® 16 0 : ã¦ã£ã³ãã¦æ å æä¸é¨ 17 pcAllow : PC表示æã®ä½å許å¯(true) 18 spAllow : ã¹ãã表示æã®ä½å許å¯(true) 19 tabAllow : ã¿ãã¬ãã表示æã®ä½å許å¯(true) 20 recheck : ã¹ã¯ãã¼ã«æ¯ã«offsetå¤ãæ´æ° 21 */ 22 if( option === undefined ) option = []; 23 if( option.selector === undefined ) option.selector = '.item'; 24 if( option.baseline === undefined ) option.baseline = 1.0; 25 if( option.pcAllow === undefined ) option.pcAllow = true; 26 if( option.spAllow === undefined ) option.spAllow = true; 27 if( option.tabAllow === undefined ) option.tabAllow = true; 28 if( option.recheck === undefined ) option.recheck = false; 29 30 //端æ«ãªãã·ã§ã³ 31 //var device = callScreenType(); 32 var device = deviceCheck; 33 if( ( !option.spAllow && device === 'sp' ) || ( !option.tabAllow && device === 'tab' ) || ( !option.pcAllow && device === 'pc' ) ){ 34 return false; 35 } 36 37 var $item = $(option.selector); 38 var initWidth = window.innerWidth; 39 var itemOffsetTop = [], 40 itemParamDuration = [], 41 itemParamDelay = [], 42 itemParamOffset = [], 43 itemParamIteration = [], 44 itemActionFlag = []; 45 46 //è¦ç´ ãé ã 47 $item.wrap('<div class="hidden"/>'); 48 49 //ãã¼ãæè¨å® 50 $(window).on('load', function(){ 51 52 $item.each(function(i){ 53 var $thisItem = $(this); 54 //å¶å¾¡ãã©ã°ãåæå 55 itemActionFlag[i] = true; 56 //åè¦ç´ ã®offsetå¤ãåå¾ 57 itemOffsetTop[i] = parseInt($thisItem.offset().top); 58 /* 59 åè¦ç´ ã®ãã©ã¡ã¼ã¿åå¾ 60 data-duration : ã¢ãã¡ã¼ã·ã§ã³é度(ç§åä½) ä¾: 1s, 0.5s, 0.75s 61 data-delay : çºç«é å»¶æé(åä¸) 62 data-offset : çºç«Y座æ¨(pxåä½) ä¾: 10, 100, 250 63 data-iteration : ç¹°ãè¿ãåæ° ä¾: 2, 10, infinite 64 */ 65 var dataDuration = $thisItem.attr('data-duration'), 66 dataDelay = $thisItem.attr('data-delay'), 67 dataOffset = $thisItem.attr('data-offset'), 68 dataIteration = $thisItem.attr('data-iteration'); 69 if( dataDuration ) itemParamDuration[i] = dataDuration; 70 if( dataDelay ) itemParamDelay[i] = dataDelay; 71 if( dataIteration ) itemParamIteration[i] = dataIteration; 72 if( dataOffset ){ 73 itemParamOffset[i] = parseInt(dataOffset); 74 itemOffsetTop[i] += itemParamOffset[i]; 75 }else{ 76 itemParamOffset[i] = 0; 77 } 78 //console.log('[load:'+i+'] offset:'+itemOffsetTop[i]); 79 //console.log('[load:'+i+'] Duration:'+dataDuration+' / Delay:'+dataDelay+' / Iteration:'+dataIteration+' / Offset:'+dataOffset); 80 }); 81 //çºç«ãã§ã㯠82 actionPointWatch(); 83 84 }); 85 86 //ã¦ã£ã³ãã¦ãªãµã¤ãºæã«ååå¾ 87 $(window).on('resize', function() { 88 var currentWidth = window.innerWidth; 89 //æ¨ªå¹ ã®å¤æ´ããªããã°ç¡è¦ 90 if (initWidth !== currentWidth){ 91 // æ¨ªå¹ ãæ´æ° 92 initWidth = currentWidth; 93 //offsetå¤ãæ´æ° 94 $item.each(function(i){ 95 itemOffsetTop[i] = parseInt($(this).offset().top) + itemParamOffset[i]; 96 //console.log('[resize:'+i+'] itemOffsetTop:'+itemOffsetTop[i]+' itemParamOffset:'+ itemParamOffset[i]); 97 }); 98 //çºç«ãã§ã㯠99 actionPointWatch(); 100 } 101 }); 102 103 //ã¹ã¯ãã¼ã«æ¯ã«çºç«ãã§ã㯠104 $(window).on('scroll', function(){ 105 if(!option.recheck){ 106 actionPointWatch(); 107 }else{ 108 //recheck:åæã«ãªãã»ããå¤ãæ´æ° 109 $item.each(function(i){ 110 itemOffsetTop[i] = parseInt($(this).offset().top) + itemParamOffset[i]; 111 //console.log('[recheck:'+i+'] itemOffsetTop:'+itemOffsetTop[i]+' itemParamOffset:'+ itemParamOffset[i]); 112 }); 113 actionPointWatch(); 114 } 115 }); 116 117 //çºç«ãã§ãã¯æ¬ä½ 118 function actionPointWatch(){ 119 120 var scroll = $(window).scrollTop() + $(window).height()*option.baseline; 121 $item.each(function(i){ 122 var $thisItem = $(this); 123 if( (itemOffsetTop[i] <= scroll) && itemActionFlag[i] ){ 124 //è¤æ°åèµ·å鲿¢ 125 itemActionFlag[i] = false; 126 //åãã©ã¡ã¼ã¿åæ 127 if(itemParamDuration[i]){ 128 $thisItem.css({ 129 //'-webkit-animation-duration':itemParamDuration[i], 130 'animation-duration':itemParamDuration[i] 131 }); 132 } 133 if(itemParamDelay[i]){ 134 $thisItem.css({ 135 //'-webkit-animation-delay':itemParamDelay[i], 136 'animation-delay':itemParamDelay[i] 137 }); 138 } 139 if(itemParamIteration[i]){ 140 $thisItem.css({ 141 //'-webkit-animation-iteration-count':itemParamIteration[i], 142 'animation-iteration-count':itemParamIteration[i] 143 }); 144 } 145 //ã¢ãã¡ã¼ã·ã§ã³å®è¡ 146 $thisItem.unwrap('.hidden').addClass('animated'); 147 //console.log('[action:'+i+'] '+itemOffsetTop[i]); 148 } 149 });
150 151 } 152 153} 154 155//ããã¤ã¹å¤å¥ 156var deviceCheck = (function(){ 157 var ua = navigator.userAgent; 158 if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPod') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0) { 159 return 'sp'; 160 } else if (ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0) { 161 return 'tab'; 162 } else { 163 return 'pc'; 164 } 165})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.