Smooth Scroll Buggy With A Partial View
So, I have a pretty unique problem (based somewhat on architecture). There is smooth scrolling on this homepage. It works fine. If you click 'Register' in the top-bar the form (par
Solution 1:
This issue was solved by implementing a system that uses hashes instead of /home/register
which is/was needed for IE and FF 3.6 support.
See this question for more details.
Code used:
// Show the register form when URL = #registerif (typeofwindow.history.pushState == "function") {
functionshowRegister() {
if (window.location.hash == '#register' ) {
var form = $('#pg-signup-register');
$('#landing-register-clip').css({ 'max-height': window.innerHeight + 'px' });
form.css({
'margin-top': ((window.innerHeight - form.outerHeight()) / 2) + 'px'
});
$('#landing-register').animate({
height: window.innerHeight + 'px'
}, 1000);
$.scrollTo(0, 500);
} else {
$('#landing-register').animate({
height: 0
}, 1000);
}
}
window.addEventListener('popstate', showRegister);
// Smooth scrolling - register form
$('a[href^="#register"], a[href="/"]').click(function () {
if (window.location.pathname != $(this).attr('href'))
window.history.pushState(null, null, $(this).attr('href'));
showRegister();
returnfalse;
});
Post a Comment for "Smooth Scroll Buggy With A Partial View"