Javascript Modal Popup

前端 未结 2 1399
失恋的感觉
失恋的感觉 2021-02-06 15:43

I\'m trying to create a simple modal popup. I have the CSS done, and the Javascript mostly done. I\'m at the point where I click a button at the button of the page and the pop

相关标签:
2条回答
  • 2021-02-06 16:08

    try position: fixed for your css, it won't scroll with this, also check display HTML page after loading complete

    example:

    <style>
    #floater    {float:left; height:50%; margin-bottom:-1px;}
    #top        {position: fixed; top:0; left: 0; width: 100%; height: 100%; background: #fff}
    #content    {clear:both; height:540px; position:relative; height: 100%; width: 100%;}
    </style>
    <div id="top">
        <div id="floater"></div>
        <div id="content">
            <div style="border: 1px solid #DDD; padding: 10px; background: #BBB; width: 300px; margin: 0 auto">Popup Contents Here</div>
        </div>
    </top>
    
    • #top element makes hides background, you can make it transparent but still unclickable.
    • #floater and #content are for vertical centering.
    0 讨论(0)
  • 2021-02-06 16:08

    Modal Popup, OnClose popup event, and more!

    https://github.com/reduardo7/xpopup

    0 讨论(0)
提交回复
热议问题