Jump to content

After next page - go to top


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 4
Link to comment
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 );
    }
  });
  • Like 1
Link to comment
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. 

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

  • 8 months later...
On 7/17/2017 at 12:56 PM, Loboo said:

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 );
    }
  });

Worked for me on PrestaShop 1.7.7.1

I added to code to /themes/core.js

Thanks !

Edited by haitam.chtiba@gmail. (see edit history)
  • Thanks 1
Link to comment
Share on other sites

  • 3 months later...
  • 11 months later...
$( '#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 );
    }
  });

I added the above code in /public_html/themes/mytheme/assets/js/custom.js and cleared cache. This works in PrestaShop 1.7.8.6. It is better not to correct in core files and use custom.js - the same goes for CSS corrections.

Link to comment
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...