I am creating a page with 5 divs. I am using the following JavaScript code to smoothly move between them horizontaly :
    $(function () {
    $('ul.nav a').bind('click', function (event) {
        var $anchor = $(this);
        $('html, body').stop().animate({
        scrollLeft: $($anchor.attr('href')).offset().left
        }, 1500,'easeInOutExpo');
        event.preventDefault();
    });
});
The Divs are something like this:
 <div class="section white" id="section5">
            <h2>Technologies</h2>
            <p>
                text
            </p>
            <ul class="nav">
                <li><a href="#section1">1</a></li>
                <li><a href="#section2">2</a></li>
                <li><a href="#section3">3</a></li>
                <li><a href="#section4">4</a></li>
                <li>5</li>
            </ul>
        </div> 
I want to start with div # 3 on page load. The only solution that worked is the onload function:
window.onload = window.location.hash = 'section3';
but unfortunately when I load the page the url address is
http://localhost:51551/trial1/MainPage.aspx#section3
even when I click on another page anchors (div) and go there the URL is stuck to MainPage.aspx#section3.
I tried the solutions here: jQuery: how to scroll to certain anchor/div on page load?
But I think because I am already using Javascript to navigate the divs, its not working. I want to Either:
- Remove the address #section3 part and keep using the onload function 
- Even better navigate to section3 at start and have the url change when I change the section 
I am using Visual Studio 2010 Express, with ASP.NET, JS and C#. on Windows 8.1