Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a single-page scroll ASP.NET website. I have a main navigation menu which scrolls down to the respective sections. The 'About Us' section has a submenu of its own. The submenu isn't a single page scroll. It shows/hides respective divs on click. I have used an update panel for this div.
The main navigation links work perfectly till i click on the submenu links. After that, if i click on the main navigation links again, the 'prevent default' no longer works. The # code of that section is shown in the address bar and the sliders in the other sections stop working.

I have used the following code for the one-page scrolling, just before the </body> :

JavaScript
jQuery(document).ready(function ($) {
            $(".scroll").click(function (e) {
                e.preventDefault();
                $('html,body').animate({ scrollTop: $(this.hash).offset().top - 20 }, 1000);
                return false;
            });
        });


How do I correct this problem?
Posted

1 solution

I solved the issue. I had applied the update panel on thw whole page. When I applied it only on the particular div which needed the update, it worked without any issues.
Learned something new today :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900