diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 0df4a83..73d017a 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -11,7 +11,7 @@ this.replaceWith(new_html); } }); - function fix_first_element() { + function fix_first_element(reset_only) { if (!window.has_topest_banner) { $('.downIcon').css('display','none'); var first_element = $('.header-banner'); @@ -24,13 +24,15 @@ } if(first_element.length != 0){ first_element.css("margin-top", ""); - var ele_offset = first_element[0].getBoundingClientRect().top; - if(first_element.parents('.kenjohn.navFixed').length == 0) - ele_offset -= window.top_barrier_height; - if(ele_offset < 0){ - first_element.css("margin-top", -ele_offset + "px"); - }else{ - first_element.css("margin-top", ""); + if(!reset_only){ + var ele_offset = first_element[0].getBoundingClientRect().top; + if(first_element.parents('.kenjohn.navFixed').length == 0) + ele_offset -= window.top_barrier_height; + if(ele_offset < 0){ + first_element.css("margin-top", -ele_offset + "px"); + }else{ + first_element.css("margin-top", ""); + } } } }else{ @@ -490,6 +492,7 @@ var navFixed = $('.kenjohn.navFixed'); window.top_barrier_height = (navFixed.length ? navFixed.height() : 0) + $('#orbit-bar').height(); if ($(window).outerWidth() < 769) { + fix_first_element(true); if (resizeTimer) clearTimeout(resizeTimer); $('.outdropdowns').before($('.header-nav')); resizeTimer = setTimeout(function() {