• Resolved milanbatinic

    (@milanbatinic)


    Hi!

    `I have a button Error notification on page https://exeprop.jakadd.se/hyresgast/ and it links to https://exeprop.jakadd.se/kontakt/#felanmalan. What happens if have option Scroll from/to different pages (i.e. scroll to target when page loads) ON is that section shows directly when button is clicked and than after delay page scroll id goes to top of the page and scrolls down to that same section. It is like having two events on the same button.
    What I try to achieve is to get the button to directly smooth scroll down to section without showing itself first.
    I hope i have managed to explain my problem in a not too complicated way 🙂

    Kind regards
    Milan

    • This topic was modified 1 year, 8 months ago by milanbatinic.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author malihu

    (@malihu)

    Hello,

    What you describe happens sometimes due to browser’s engine in combination to cache, site layout and markup (in most cases the page will scroll smoothly to the target after it loads without “jumping” to the target first, but it seems that this is not the case for you).

    This means that we don’t have full control over when exactly the page will smooth scroll to the target after it loads.

    We might be able to overcome this issue with some extra custom js code but we have to test it first.

    Re-enable “Scroll from/to different pages” option and let me know so I can check if we can do it via css/javascript.

    Thread Starter milanbatinic

    (@milanbatinic)

    Hi!

    Thank you for your time. I have enabled “Scroll from/to different pages”.

    Kind regards
    Milan

    Plugin Author malihu

    (@malihu)

    OK, try this:

    1.Add the following to your custom/additional CSS (e.g. in appearance > customizer > additional css):

    #felanmalan{
        display: none;
    }

    2.Add the following script to your theme/child-theme footer.php template just before the closing body tag (</body>):

    <script>
    (function($){
        $(window).on("load",function(){
          $("#felanmalan").css("display","block");
        });
    })(jQuery);
    </script>

    You can edit your theme’s templates via FTP or in appearance > themes > editor.

    Let me know

    Thread Starter milanbatinic

    (@milanbatinic)

    I have done some testing and it seems to be working well 🙂 I dont quite understand how the event does the trick but thank you very much I really appreciate it!

    Kind regards
    Milan

    Plugin Author malihu

    (@malihu)

    You’re welcome 🙂

    The css hides the target element and the js script makes it visible again (after the page is fully loaded). This trick basically prevents the page from jumping to the target because browsers do not jump to page anchors that are hidden.

    Marking this as resolved but let me know if you need more help.

    Thread Starter milanbatinic

    (@milanbatinic)

    “browsers do not jump to page anchors that are hidden” think i get it now. Thank you for the answer and for sharing your knowledge with me 🙂

    Kind regards
    Milan

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Page scroll to id after default event’ is closed to new replies.