-2

i know there are some topics for this problems...

whatever i try i could not handle it...

first of all i am a wordpress user and installed a wcfm marketplace plugin... i suppose that for some reasons they ignored javascripts in store listing pages therefore when you try to reach mobile browser then filter pages is located bottom of the page...and this is not good for user experience so i decided to make a something that scrolling to the filters div section when they clicks to the filters button.

$(".woodmart-filter-buttons").ready(function(){
$("html, body").delay(2000).animate({
    scrollTop: $('#wcfmmp-store-product-search-5').offset().top 
}, 2000);
});

i tried this code for achive my goal but it did not worked.

Thanks for your helps.

johannchopin
  • 7,327
  • 6
  • 22
  • 62
  • 1
    Does this answer your question? [jQuery scroll to element](https://stackoverflow.com/questions/6677035/jquery-scroll-to-element) – johannchopin Dec 23 '19 at 16:19

2 Answers2

0

https://jsfiddle.net/dkw36xz1/

You're code works for me when I change it to:

$(document).ready(function(){
  $("html, body").delay(2000).animate({
      scrollTop: $('#wcfmmp-store-product-search-5').offset().top 
  }, 2000);
});
TKoL
  • 10,782
  • 1
  • 26
  • 50
0

Look at my GitHub repository, I think that's what you need to create a smooth motion as the page scrolls down from div to element, remembering that you have to anchor your div's to make it possible. https://github.com/Guilherme-A-Lara/smooth-on-JS

  • Welcome to SO! Please post the relevant code of your answer *in text*, and only use external links to justify/add to your answer. – Saucy Goat Dec 23 '19 at 16:55