I have a one page site, and im using the following code for scrolling between the pages:
function gotoPage() {
var cur = $(this);
var role = cur.attr('role');
var target = $('#' + role);
$('html,body').animate({
scrollTop: target.offset().top - 94
}, 1000);
}
$('.navBt').click(gotoPage);
HTML:
<div class="navBt" role="topSpacing">
<img src="img/nav_campaign.png" />
</div>
<div class="navBt" role="sectionD">
<img src="img/nav_club.png" />
</div>
It works perfectly on any browser except IE. When i open it on IE9 (not sure about other versions) it wouldnt work, but once i press F12 to open the inspection, it would start working normally from that point, even if i refresh the page or enter the page again without the inspection opened.
Any ideas why?