Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xnau webdesign

    (@xnau)

    You need to add some code to the page. Do you know anything about using javascript?

    Topfed

    (@stefan002377)

    Yes I know Javascript, What code should I add?

    Plugin Author xnau webdesign

    (@xnau)

    OK, it can be pretty simple, but the issue for the original poster is unclear. Does this happen after a search request?

    Anyway, when a search request is submitted, the hash “#participants-list” is added to the URL, the browser should scroll the page to the top of the search form, which has an ID of “participants-list.” If it’s not doing that, then there is probably some scrolling code in the theme (or maybe a plugin) that is interfering.

    It’s also possible that due to the presence of multiple plugins shortcodes there is more than one element with that ID, which causes problems.

    The javascript solution is probably to check for that hash, and if present in the URL, scroll to the desired place…something like:

    <script>
    jQuery(document).ready(function ($){
       if (window.location.hash === 'participants-database') {
          $('html, body').animate({
                               scrollTop: $(".pdb-list").first().offset().top
                           }, 500);
       }
    });
    </script>

    That is assuming you want to scroll to the top of the first list $('.pdb-list').first() and assuming there could be more than one on the page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘need page to reload to top of page on large forms’ is closed to new replies.