Forums Forums General Scroll to results after new page has opened

Viewing 7 posts - 1 through 7 (of 7 total)
  • Anonymous
    #214300

    Hi,

    I use a SFP widget on my homepage at fertila.de. After submitting, a new page is opened with the results. I want users to land right on the results (especially important on mobile). I tried in the settings the Ajax scroll to custom selector. However this seems not to work in a new window.

    Thanks for your help
    Georg

    Trevor
    #214307

    Results URL appears to be:

    https://fertila.de/kinderwunschzentren/

    You would need to add some Javascript to the page that, on document load, scrolls the page to the div with ID search-filter-results-8030.

    Anonymous
    #214309

    OK, great. What js would I have to add?
    Thank you
    Georg

    Trevor
    #214311

    I haven’t tested this, but something like:

    <script>
    (function ( $ ) {
      $(document).on("ready", function(){
        $('html, body').animate({
            scrollTop: $('#search-filter-results-8030').offset().top
        }, 'slow');
      });
    }(jQuery));
    </script>
    Anonymous
    #214313

    Works. However, now there is an autoscroll as well when I just enter the URL https://fertila.de/kinderwunschzentren/
    Which I do not want.

    Trevor
    #214320

    Try this maybe:

    <script>
    (function ( $ ) {
      $(document).on("ready", function(){
        if (window.location.href.indexOf('kinderwunschzentren/?_') > 0) {
          $('html, body').animate({
            scrollTop: $('#search-filter-results-8030').offset().top
          }, 'slow');
        }
      });
    }(jQuery));
    </script>
    Anonymous
    #214322

    This is it. Thanks a lot and have a nice day!
    Georg

Viewing 7 posts - 1 through 7 (of 7 total)