Support » Plugin: Modal Popup Box - Popup Builder » Clicking popup button causes the website to scroll to the top of the page

  • Resolved pushka

    (@pushka)


    I have multiple buttons showing more info, but clicking a button goes to the top of the page, so the user can’t keep on looking through the cards of information I have..
    Is this normal or a plugin conflict?
    Is there any way to not have the website scroll to the top of the page, or scroll back down after closing the popup?

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

Viewing 1 replies (of 1 total)
  • I have fixed this myself:

    1) when someone clicks a button – store the scroll location in a global JS variable

    2) when clicking “close-button” or “background behind popup”
    – scroll down to where that saved position is.

    Javascript:

    function scroll_to_button(){
    window.scrollTo(0,global_page_pos);
    }

    jQuery(“.md-overlay”).click(function() {
    scroll_to_hotel();
    setTimeout(scroll_to_hotel, 111);
    });

    jQuery(“.md-close”).click(function() {
    scroll_to_hotel();
    setTimeout(scroll_to_hotel, 111);
    });

    var global_page_pos = 0;

    $(“.mpb-shotcode-buttons div”).click(function () {
    global_page_pos = window.pageYOffset;
    });

Viewing 1 replies (of 1 total)
  • The topic ‘Clicking popup button causes the website to scroll to the top of the page’ is closed to new replies.