Jump to content
Vilius PromoApranga

After next page - go to top

Recommended Posts

Hi I would like to change the theme a abit, how to make after paging to the next or previous page in products, to show page top? Not to stay in the same place?

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

 

me too, it's tedious to have to scroll manually on page change...

I'm looking for a solution to that, but without success by now.

Share this post


Link to post
Share on other sites

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

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

Im new prestashop 1.7.2.2 this feature is in stock.

 

Give me address your shop. i will try make compabilty code

  • Like 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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

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.

Share this post


Link to post
Share on other sites
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

The above code works perfect in PS 1.7.6.5 

Great job!

Share this post


Link to post
Share on other sites
Posted (edited)

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
Posted (edited)

I put it at the botton, but didn't work for me 😕

Prestashop 1.7.6.5

themes/mytheme/assets/js/custom.js

 

imagen.png

 

 

Edited by Toshi_akea (see edit history)

Share this post


Link to post
Share on other sites
On 6/1/2020 at 2:08 PM, hasan.shaker said:

It’s normal, you have to empty the cache

It works!

Thanks! :)

Share this post


Link to post
Share on other sites

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