cherry pick 34395a2c
Showing
1 changed file
with
41 additions
and
35 deletions
... | @@ -203,45 +203,51 @@ if ($this->params->get('logoFile')) { | ... | @@ -203,45 +203,51 @@ 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 | jQuery(function($) { | 206 | window.onload = function() { |
207 | var obj = $("#aside"); | 207 | jQuery(function($) { |
208 | var offset = $(obj).offset(); | 208 | var obj = $("#aside"); |
209 | var topPadding = 135; | 209 | var sW = window.innerWidth; |
210 | var sW = window.innerWidth; | 210 | var sH = window.innerHeight; |
211 | var sH = window.innerHeight; | 211 | var cW = obj.width(); |
212 | var cW = obj.width(); | 212 | var cH = obj.height(); |
213 | var cH = obj.height(); | 213 | var cwrapH = $("#c_wrap").height(); |
214 | var cwrapH = $("#c_wrap").height(); | 214 | // 特定のページではスクロールしない |
215 | // 特定のページではスクロールしない | 215 | var excludedPages = [".record-page"]; |
216 | var excludedPages = [".record-page"]; | 216 | var excludedPagesSelector = excludedPages.join(', '); |
217 | var excludedPagesSelector = excludedPages.join(', '); | 217 | var isExcluded = false; |
218 | var isExcluded = false; | 218 | if (document.querySelector(excludedPagesSelector)) { |
219 | if (document.querySelector(excludedPagesSelector)) { | 219 | isExcluded = true; |
220 | isExcluded = true; | 220 | } |
221 | } | 221 | var customHeight = $(".custom").height(); |
222 | 222 | var paddingTop = customHeight - 80; | |
223 | if (cH) { | 223 | |
224 | if (sH > cH) { | 224 | if (cH) { |
225 | if (isExcluded) return false; | 225 | if (sH > cH) { |
226 | $(window).scroll(function() { | 226 | if (isExcluded) return false; |
227 | if ($(window).scrollTop() > offset.top) { | 227 | $(window).resize(function() { |
228 | if ($(window).scrollTop() < cwrapH) { | 228 | customHeight = $(".custom").height(); |
229 | paddingTop = customHeight - 80; | ||
230 | }); | ||
231 | $(window).scroll(function() { | ||
232 | if ($(window).scrollTop() > customHeight) { | ||
233 | if ($(window).scrollTop() < cwrapH) { | ||
234 | $(obj).stop().animate({ | ||
235 | duration: 'fast', | ||
236 | marginTop: $(window).scrollTop() - paddingTop | ||
237 | }); | ||
238 | } else { | ||
239 | $(obj).stop().animate({}); | ||
240 | } | ||
241 | } else { | ||
229 | $(obj).stop().animate({ | 242 | $(obj).stop().animate({ |
230 | duration: 'fast', | 243 | marginTop: 0 |
231 | marginTop: $(window).scrollTop() - offset.top + topPadding | ||
232 | }); | 244 | }); |
233 | } else { | ||
234 | $(obj).stop().animate({}); | ||
235 | } | 245 | } |
236 | } else { | 246 | }); |
237 | $(obj).stop().animate({ | 247 | } |
238 | marginTop: 0 | ||
239 | }); | ||
240 | } | ||
241 | }); | ||
242 | } | 248 | } |
243 | } | 249 | }); |
244 | }); | 250 | }; |
245 | </script> | 251 | </script> |
246 | 252 | ||
247 | </head> | 253 | </head> | ... | ... |
-
Please register or sign in to post a comment