34395a2c by TaishiTokudome

サイドメニューのスタイル修正。画像が読み込まれてから追従を開始、リサイズした場合サイドメニュー表示位置の再計算を行う

1 parent 36698a70
...@@ -203,24 +203,37 @@ if ($this->params->get('logoFile')) { ...@@ -203,24 +203,37 @@ if ($this->params->get('logoFile')) {
203 <link rel="apple-touch-icon" href="/apple-touch-icon.png"> 203 <link rel="apple-touch-icon" href="/apple-touch-icon.png">
204 204
205 <script> 205 <script>
206 window.onload = function() {
206 jQuery(function($) { 207 jQuery(function($) {
207 var obj = $("#aside"); 208 var obj = $("#aside");
208 var offset = $(obj).offset();
209 var topPadding = 135;
210 var sW = window.innerWidth; 209 var sW = window.innerWidth;
211 var sH = window.innerHeight; 210 var sH = window.innerHeight;
212 var cW = obj.width(); 211 var cW = obj.width();
213 var cH = obj.height(); 212 var cH = obj.height();
214 var cwrapH = $("#c_wrap").height(); 213 var cwrapH = $("#c_wrap").height();
214 // 特定のページではスクロールしない
215 var excludedPages = [".record-page"];
216 var excludedPagesSelector = excludedPages.join(', ');
217 var isExcluded = false;
218 if (document.querySelector(excludedPagesSelector)) {
219 isExcluded = true;
220 }
221 var customHeight = $(".custom").height();
222 var paddingTop = customHeight - 80;
215 223
216 if (cH) { 224 if (cH) {
217 if (sH > cH) { 225 if (sH > cH) {
226 if (isExcluded) return false;
227 $(window).resize(function() {
228 customHeight = $(".custom").height();
229 paddingTop = customHeight - 80;
230 });
218 $(window).scroll(function() { 231 $(window).scroll(function() {
219 if ($(window).scrollTop() > offset.top) { 232 if ($(window).scrollTop() > customHeight) {
220 if ($(window).scrollTop() < cwrapH) { 233 if ($(window).scrollTop() < cwrapH) {
221 $(obj).stop().animate({ 234 $(obj).stop().animate({
222 duration: 'fast', 235 duration: 'fast',
223 marginTop: $(window).scrollTop() - offset.top + topPadding 236 marginTop: $(window).scrollTop() - paddingTop
224 }); 237 });
225 } else { 238 } else {
226 $(obj).stop().animate({}); 239 $(obj).stop().animate({});
...@@ -234,6 +247,7 @@ if ($this->params->get('logoFile')) { ...@@ -234,6 +247,7 @@ if ($this->params->get('logoFile')) {
234 } 247 }
235 } 248 }
236 }); 249 });
250 };
237 </script> 251 </script>
238 252
239 </head> 253 </head>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!