cherry pick 34395a2c
Showing
1 changed file
with
10 additions
and
4 deletions
... | @@ -203,10 +203,9 @@ if ($this->params->get('logoFile')) { | ... | @@ -203,10 +203,9 @@ 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(); |
... | @@ -219,16 +218,22 @@ if ($this->params->get('logoFile')) { | ... | @@ -219,16 +218,22 @@ if ($this->params->get('logoFile')) { |
219 | if (document.querySelector(excludedPagesSelector)) { | 218 | if (document.querySelector(excludedPagesSelector)) { |
220 | isExcluded = true; | 219 | isExcluded = true; |
221 | } | 220 | } |
221 | var customHeight = $(".custom").height(); | ||
222 | var paddingTop = customHeight - 80; | ||
222 | 223 | ||
223 | if (cH) { | 224 | if (cH) { |
224 | if (sH > cH) { | 225 | if (sH > cH) { |
225 | if (isExcluded) return false; | 226 | if (isExcluded) return false; |
227 | $(window).resize(function() { | ||
228 | customHeight = $(".custom").height(); | ||
229 | paddingTop = customHeight - 80; | ||
230 | }); | ||
226 | $(window).scroll(function() { | 231 | $(window).scroll(function() { |
227 | if ($(window).scrollTop() > offset.top) { | 232 | if ($(window).scrollTop() > customHeight) { |
228 | if ($(window).scrollTop() < cwrapH) { | 233 | if ($(window).scrollTop() < cwrapH) { |
229 | $(obj).stop().animate({ | 234 | $(obj).stop().animate({ |
230 | duration: 'fast', | 235 | duration: 'fast', |
231 | marginTop: $(window).scrollTop() - offset.top + topPadding | 236 | marginTop: $(window).scrollTop() - paddingTop |
232 | }); | 237 | }); |
233 | } else { | 238 | } else { |
234 | $(obj).stop().animate({}); | 239 | $(obj).stop().animate({}); |
... | @@ -242,6 +247,7 @@ if ($this->params->get('logoFile')) { | ... | @@ -242,6 +247,7 @@ if ($this->params->get('logoFile')) { |
242 | } | 247 | } |
243 | } | 248 | } |
244 | }); | 249 | }); |
250 | }; | ||
245 | </script> | 251 | </script> |
246 | 252 | ||
247 | </head> | 253 | </head> | ... | ... |
-
Please register or sign in to post a comment