Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

Go to top of webpage with jQuery Dialog box/model box

Hello Friends,

Today, I was working with jQuery model box, everything was fine but the problem with page length. Page was long and I need to open jQuery Model box when visitor click on link which is at the bottom of the page. So when visitor click on the link, jQuery model box opens but it opens at the top of the page. I can not make simple back to page anchor tag on the link as there is a jQuery Model box link is already there. Here is the way to go back to top of the page using jQuery. You need to add this one line code in jQuery model box click function.

Find:
$(‘a[name=modal]’).click(function(e) {

Replace:
$(‘a[name=modal]’).click(function(e) {
$( ‘html, body’ ).animate( { scrollTop: 0 }, ‘slow’ );

Let me know if you find any problem.

Thank you!

Share:

No Comments Yet.

Leave a Reply

Your email address will not be published.