Smooth one page site with changing URL
-
Hi,
I′m a beginner in creating custom WP themes. I tried to make one page site. When I clicked on manu link the site scrolled down on page but I wanted to do smooth scrolling so I added jquery code:
$(function(){
var menu1 = $(“.menu-top”);
var menulink1 = menu1.find(‘a’);$(menulink1).on(“click”, function(){
$(‘html,body’).animate({scrollTop: $(‘[name=”‘ + $.attr(this, ‘href’).substr(1) + ‘”]’).offset().top
}, 500);
return false;
});
});$(function(){
$(‘.back-to-top’).on(‘click’, function(){
$(‘body’).animate({ scrollTop: 0});
});Now my scrolling is smooth but when the site scroll down URL address doesn′t change is still fidastav.konekto.net. I would like to have fidastav.konekto.net/#portfolio or fidastav.konekto.net/#kontakt.
How do I fix it? And is there any code when I scroll down/up with mouse change this url?
Thanks a lot
- The topic ‘Smooth one page site with changing URL’ is closed to new replies.