Jump to content

After next page - go to top


Go to solution Solved by Loboo,

Recommended Posts

  • 6 months later...

Hi, 

 

Try this 

  $( '#products' ).on( 'click', '.js-search-link', function( event ) {
    var target = $( "#header" );
    if ( target.length ) {
      event.preventDefault();
      $( 'html, body' ).animate( {
        scrollTop: target.offset().top+300
      }, 1000 );
    }
  });
  • Thanks 2

Share this post


Link to post
Share on other sites
  • 1 month later...

Hi, I'm having same issue.

Where to to put you suggested code?

 

Thanks!

 

 

Hi, 

 

Try this 

  $( '#products' ).on( 'click', '.js-search-link', function( event ) {
    var target = $( "#header" );
    if ( target.length ) {
      event.preventDefault();
      $( 'html, body' ).animate( {
        scrollTop: target.offset().top+300
      }, 1000 );
    }
  });

Share this post


Link to post
Share on other sites
  • 1 month later...
  • 4 weeks later...
13 hours ago, illycoffee said:

Hi,

how could I fix the same issue in 1.7.1.1? Can I use the same code?

Didn't understand where to put it in /themes/core.js ... at the bottom?

Thanks

 

Yep just copy paste it to the very bottom, that's what did it for me. 

Share this post


Link to post
Share on other sites
  • 1 year later...
  • 4 weeks later...

In PS 1.7.6 it might be this:

$(document).ready(() => {
  prestashop.on('updateProductList', () => {
    let target = $("#wrapper");
    if (target.length) {
      $('html, body').animate({
        scrollTop: target.offset().top
      }, 0);
    }
  });
});

 

This is taken from @Loboo's solutuon, but I scroll to #wrapper without animation time.

  • Like 1

Share this post


Link to post
Share on other sites
  • 3 weeks later...
On 11/12/2019 at 6:21 PM, Flower7C3 said:

In PS 1.7.6 it might be this:


$(document).ready(() => {
  prestashop.on('updateProductList', () => {
    let target = $("#wrapper");
    if (target.length) {
      $('html, body').animate({
        scrollTop: target.offset().top
      }, 0);
    }
  });
});

 

This is taken from @Loboo's solutuon, but I scroll to #wrapper without animation time.

Don't work with my prestacrea theme... Is it just for default theme ?

  • Like 1

Share this post


Link to post
Share on other sites
19 hours ago, Jean Francois G said:

Don't work with my prestacrea theme... Is it just for default theme ?

It works on my custom theme. You have check if updateProductList event and target element exists in Your code.

Share this post


Link to post
Share on other sites
  • 4 months later...
  • 1 month later...
  • 3 weeks later...

works perfect in PS 1.7.6.1 --> themes/mytheme/assets/js/custom.js

$(document).ready(() => {
    prestashop.on('updateProductList', () => {
        let target = $("#wrapper");
        if (target.length) {
            $('html, body').animate({
                scrollTop: target.offset().top+350
            }, 500);
        }
    });
});

 

Edited by hshaker (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites
  • 8 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More