1jQuery(function ($) { 2 // ç¾å¨ã®ç¶æ 3 var widthId; 4 5 // å¶å¾¡å¯¾è±¡è¦ç´ ã®åå¾ 6 const $topWrapper = $('#top-wrapper'); 7 const $topImageWrapper = $('#top-image-wrapper'); 8 const $topImage = $('#top-image'); 9 const $menuCheckbox = $('#hamburger-checkbox'); 10 11 $(window).on('load', function () { 12 UpdateWidthId(); 13 14 // ãããç»åãèªã¿è¾¼ã¿ 15 if ($topImage.hasClass('lazy-load')) { 16 const backgroundImageUrl = $topImage.attr('download-background-image'); 17 $topImage.css('background-image', 'url(\'' + backgroundImageUrl + '\')'); 18 } 19 20 // èªã¿è¾¼ã¿ä¸è¡¨ç¤ºãçµäº 21 $('#loader-wrapper').fadeOut(800, function () { 22 $('#loader-wrapper').remove(); 23 }); 24 25 // ååç¨ã®ã¢ãã¡ã¼ã·ã§ã³ãçºç«ããã 26 $topImage.addClass('parallax-transition'); 27 $topImage.removeClass('parallax-load-before'); 28 $topImage.addClass('parallax-load-after'); 29 30 AdjustHeight(); 31 DownloadSrc(); 32 }); 33 34 function AdjustHeight() { 35 // åçä»ãã¡ãã¥ã¼ã®ä¸é¨è¦ç´ ã®é«ããèª¿æ´ 36 const $elements = $('#recommended-menu-container').find('.recommended-menu-summary'); 37 var maxHeight = -1; 38 var beforeTop = -1; 39 var rowStartedElementIndex = 0; 40 $elements.each(function (i, element) { 41 const $jQueryElement = $(element); 42 const height = $jQueryElement.height(); 43 var top = $jQueryElement.offset().top; 44 45 // æå¤§é«ãã®è©ä¾¡ 46 if (height > maxHeight) { 47 maxHeight = height; 48 } 49 50 // è¡ã®å¤ããç®ãæ¤åº 51 const delta = 10; 52 if (beforeTop >= 0 && Math.abs(top - beforeTop) > delta) { 53 // console.debug(maxHeight); 54 55 // åã®è¦ç´ ã¾ã§ãå¦ç 56 for (var j = rowStartedElementIndex; j < i; j++) { 57 const $adjustTarget = $($elements[j]); 58 const beforeHeight = $adjustTarget.height(); 59 60 const addHeight = maxHeight - beforeHeight; 61 if (addHeight > 0) { 62 $adjustTarget.css('margin-bottom', addHeight + 'px'); 63 } 64 } 65 66 // 次ã®è¡ãå¦çããããã®åæå 67 maxHeight = -1; 68 beforeTop = -1; 69 rowStartedElementIndex = i; 70 71 // èªèº«ã®topã¯åè©ä¾¡ããå¿ è¦ããã 72 top = $jQueryElement.offset().top; 73 } 74 75 beforeTop = top; 76 }); 77 } 78 79 // ãªãµã¤ãºæã®å¦ç 80 $(window).on('resize', function () { 81 UpdateWidthId(); 82 AdjustHeight(); 83 }); 84 85 /** 86 * @return {boolean} 87 */ 88 function UpdateWidthId() { 89 const width = $(window).width(); 90 91 var newWidthId; 92 if (width >= 1200) { 93 newWidthId = 'xl'; 94 } else if (width >= 992) { 95 newWidthId = 'lg'; 96 } else if (width >= 768) { 97 newWidthId = 'md'; 98 } else if (width >= 576) { 99 newWidthId = 'sm'; 100 } else { 101 newWidthId = 'ms'; 102 } 103 104 if (widthId === newWidthId) { 105 return false; 106 } 107 108 widthId = newWidthId; 109 console.log(width + ':' + widthId); 110 111 return true; 112 } 113 114 // ã¹ã¯ãã¼ã«æã®å¦ç 115 $(window).on('scroll', function () { 116 const scroll = $(window).scrollTop(); 117 118 $topImage.removeClass('parallax-transition'); 119 120 // TODO ããã¡ãã£ã¨ç¶ºéºã«HTMLãçµãã§ããã°ä¸è¦ 121 // ãããé¨åã¯ã¹ã¯ãã¼ã«ç¯å²å¤ã¨ãªã£ããé表示 122 if (scroll > $topImageWrapper.height()) { 123 $topWrapper.css('visibility', 'hidden'); 124 } else { 125 $topWrapper.css('visibility', 'visible'); 126 } 127 128 // ããç¨åº¦ã¹ã¯ãã¼ã«ããã¦ããã°ãããç»åãã¼ãã 129 if (scroll > 100) { 130 $topImage.removeClass('parallax-blur-off'); 131 $topImage.addClass('parallax-blur-on'); 132 } else { 133 $topImage.removeClass('parallax-blur-on'); 134 $topImage.addClass('parallax-blur-off'); 135 } 136 137 DownloadSrc(); 138 });
139 140 function DownloadSrc() { 141 const windowHeight = $(window).height(); 142 const scrollTop = $(window).scrollTop(); 143 144 // 表示ç¯å²å ã¨è¿ãã®ç»åããã¦ã³ãã¼ã 145 $('.lazy-load').each(function (i, element) { 146 const $target = $(element); 147 148 // è¦ç´ ã表示ãããã¾ã§ã®æ®ãã¹ã¯ãã¼ã«é 149 const scrollRemain = $target.offset().top - (scrollTop + windowHeight); 150 151 // ããç¨åº¦è¿ã¥ãã¦ããã°ãã¦ã³ãã¼ã 152 if (scrollRemain < 300) { 153 $target.removeClass('lazy-load'); 154 155 if ($target.hasClass('with-animation')) { 156 $target.addClass('lazy-load-after'); 157 } 158 159 $target.attr('src', $target.attr('download-src')); 160 } 161 }); 162 } 163 164 // ã¢ãã¡ã¼ã·ã§ã³ä»ããªã³ã¯ã®å¦ç 165 $('.animation-link').on('click', function () { 166 // 対象è¦ç´ ï¼è£æ£ã®ä½ç½®ã¸ã¹ã¯ãã¼ã« 167 const href = $(this).attr('href'); 168 const target = $(href == "#" || href == "" ? 'html' : href); 169 const position = target.offset().top; 170 $('body,html').animate({scrollTop: position}, 400, 'swing'); 171 172 return false; 173 }); 174 175 // ãã¼ã¸å ãªã³ã¯ã®å¦ç 176 $('.section-link').on('click', function () { 177 // ããã²ã¼ã·ã§ã³ã¡ãã¥ã¼ã®é«ãåãè£æ£ 178 var diff = 0; 179 const $navigation = $('#global-navigation'); 180 if ($navigation) { 181 diff = $navigation.height(); 182 } 183 184 // 対象è¦ç´ ï¼è£æ£ã®ä½ç½®ã¸ã¹ã¯ãã¼ã« 185 const href = $(this).attr('href'); 186 const target = $(href == "#" || href == "" ? 'html' : href); 187 const position = target.offset().top - diff; 188 $('body,html').animate({scrollTop: position}, 400, 'swing'); 189 190 // ã¡ãã¥ã¼ãéãã¦ããã°éãã 191 if ($menuCheckbox.prop('checked') === true) { 192 $menuCheckbox.prop("checked", false); 193 } 194 195 return false; 196 }); 197 198 // ããããã¼ã¸ã¸é·ç§»ãããªã³ã¯ã®å¦ç 199 $('.top-link').on('click', function () { 200 $('body,html').animate({scrollTop: 0}, 400, 'swing'); 201 202 // ã¡ãã¥ã¼ãéãã¦ããã°éãã 203 if ($menuCheckbox.prop('checked') === true) { 204 $menuCheckbox.prop("checked", false); 205 } 206 207 return false; 208 }); 209});
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.