Vilius PromoApranga Posted January 5, 2017 Share Posted January 5, 2017 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? 1 Link to comment Share on other sites More sharing options...
darruest Posted July 14, 2017 Share Posted July 14, 2017 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. Link to comment Share on other sites More sharing options...
Loboo Posted July 17, 2017 Share Posted July 17, 2017 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 ); } }); 4 Link to comment Share on other sites More sharing options...
fpereira Posted September 1, 2017 Share Posted September 1, 2017 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 ); } }); 1 Link to comment Share on other sites More sharing options...
Loboo Posted September 1, 2017 Share Posted September 1, 2017 Im new prestashop 1.7.2.2 this feature is in stock. Give me address your shop. i will try make compabilty code 1 Link to comment Share on other sites More sharing options...
Snorreh Posted October 16, 2017 Share Posted October 16, 2017 (edited) Thanks, this works! (added this to /themes/core.js) Edited October 16, 2017 by Snorreh (see edit history) Link to comment Share on other sites More sharing options...
illycoffee Posted November 7, 2017 Share Posted November 7, 2017 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 Link to comment Share on other sites More sharing options...
Snorreh Posted November 8, 2017 Share Posted November 8, 2017 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 More sharing options...
Tajriba Posted October 21, 2019 Share Posted October 21, 2019 Works. Thanks! Link to comment Share on other sites More sharing options...
Flower7C3 Posted November 12, 2019 Share Posted November 12, 2019 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. 1 Link to comment Share on other sites More sharing options...
Jean Francois G Posted December 3, 2019 Share Posted December 3, 2019 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 ? 1 Link to comment Share on other sites More sharing options...
Flower7C3 Posted December 4, 2019 Share Posted December 4, 2019 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. Link to comment Share on other sites More sharing options...
Jean Francois G Posted December 4, 2019 Share Posted December 4, 2019 how can i do that ? Link to comment Share on other sites More sharing options...
fosilia Posted April 6, 2020 Share Posted April 6, 2020 Perfect for 1.7.6.4. Thanks. Link to comment Share on other sites More sharing options...
ilisiaraul Posted May 13, 2020 Share Posted May 13, 2020 The above code works perfect in PS 1.7.6.5 Great job! Link to comment Share on other sites More sharing options...
hshaker Posted May 29, 2020 Share Posted May 29, 2020 (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 May 29, 2020 by hshaker (see edit history) 3 Link to comment Share on other sites More sharing options...
Toshi_akea Posted June 1, 2020 Share Posted June 1, 2020 (edited) I put it at the botton, but didn't work for me 😕 Prestashop 1.7.6.5 themes/mytheme/assets/js/custom.js Edited June 1, 2020 by Toshi_akea (see edit history) Link to comment Share on other sites More sharing options...
hasan.shaker Posted June 1, 2020 Share Posted June 1, 2020 It’s normal, you have to empty the cache 1 Link to comment Share on other sites More sharing options...
Toshi_akea Posted June 3, 2020 Share Posted June 3, 2020 On 6/1/2020 at 2:08 PM, hasan.shaker said: It’s normal, you have to empty the cache It works! Thanks! Link to comment Share on other sites More sharing options...
Oleg Tortajada Posted March 2, 2021 Share Posted March 2, 2021 (edited) Worked with 1.7.6.8, failed for 1.7.7.0 Edited March 18, 2021 by Oleg Tortajada (see edit history) Link to comment Share on other sites More sharing options...
haitam.chtiba@gmail. Posted March 9, 2021 Share Posted March 9, 2021 (edited) 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 March 9, 2021 by haitam.chtiba@gmail. (see edit history) 1 Link to comment Share on other sites More sharing options...
ADV_00 Posted July 8, 2021 Share Posted July 8, 2021 I am using version 1.7.7.3. How can I proceed? the methods listed above did not work. Thank you Link to comment Share on other sites More sharing options...
haitam.chtiba@gmail. Posted July 8, 2021 Share Posted July 8, 2021 Don't forget to delete cache after adding the function code to /themes/core.js Link to comment Share on other sites More sharing options...
ADV_00 Posted July 8, 2021 Share Posted July 8, 2021 I can't find the core.js file in the file manager. Where is?? Link to comment Share on other sites More sharing options...
haitam.chtiba@gmail. Posted July 12, 2021 Share Posted July 12, 2021 (edited) Core.js file is located on themes folder /themes/core.js Edited July 12, 2021 by haitam.chtiba@gmail. (see edit history) Link to comment Share on other sites More sharing options...
Prestafan1234 Posted June 17, 2022 Share Posted June 17, 2022 $( '#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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now