Y
Y
Yuri Gets2018-02-22 17:21:53
css
Yuri Gets, 2018-02-22 17:21:53

How to fix the background of a Popup (modal window) on iOS?

For Android and Windows, the background is fixed, but for iOS it does not work.
Below is the code used.
CSS:

.scroll-hidden {
    overflow: hidden;
}

JS:
<script>
    $(document).ready(function(){
        PopUpHide();
    });

    function PopUpShow(){
        $("#popup1").show();
        $("body").addClass("scroll-hidden");
    }

    function PopUpHide(){
        $("#popup1").hide();
        $("body").removeClass("scroll-hidden");
    } 
</script>

ps site here:
https://yurii-hets.blogspot.com

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fl3nkey, 2018-02-24
@FLUNKEY

I can suggest using this solution: https://jsfiddle.net/FL3N/1gaxegxp/
To do this, use this library: https://github.com/FL3NKEY/fix-scroll
Also read the small documentation for this library, specifically the section "Preventing ", the problem and solution for iOS are described there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question