Modal Scroll Sorunu

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    adiga
    adiga's avatar
    Kayıt Tarihi: 09/Kasım/2020
    Erkek

    merhaba, modal yapmaya çalışıyorum fakat modal açıldığında bile scroll aşağı yukarı hareket edebiliyor. bu sorunu nasıl çözebilirim.

     

    modal.min.css

    .modals,
    .modals *,
    .modals *:before,
    .modals *:after {
      box-sizing: border-box;
    }
    
    .modals {
      align-items: center;
      background-color: rgba(0, 0, 0, 0.7);
      bottom: 0;
      display: none;
      justify-content: center;
      left: 0;
      position: fixed;
      right: 0;
      top: 0;
      z-index: 999;
    }
    
    .modals-shown {
      display: flex;
    }
    
    .modal {
      background: #fff;
      border-radius: 3px;
      box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
      display: none;
      flex-direction: column;
      max-height: 90%;
      overflow: auto;
      position: relative;
      right: 0;
      width: 90%;
    }
    
    .modal-shown {
      display: flex;
    }
    
    .modal-header {
      border-bottom: 1px solid #ddd;
      flex-grow: 0;
      flex-shrink: 0;
      overflow: hidden;
      padding: 12px 22px;
      position: relative;
      width: 100%;
    }
    .modal-header h1,
    .modal-header h2,
    .modal-header h3,
    .modal-header h4,
    .modal-header h5 {
      margin: 0;
    }
    
    .modal-footer {
      border-top: 1px solid #ddd;
      overflow: hidden;
      padding: 16px;
    }
    
    .modal-content {
      padding: 16px 24px;
    }
    
    .modal-small {
      max-width: 400px;
    }
    
    .modal-medium {
      max-width: 600px;
    }
    
    .modal-scrollable .modal-content {
      overflow-y: auto;
    }
    
    .modal-close {
      background-image: url("img/close.svg");
      background-position: center center;
      background-repeat: no-repeat;
      background-size: 25px 25px;
      cursor: pointer;
      height: 35px;
      margin: 7px;
      opacity: 0.3;
      padding: 10px;
      position: absolute;
      right: 0;
      top: 0;
      width: 35px;
    }
    .modal-close:hover {
      background-color: #ddd;
      opacity: 0.5;
    }

     

    index.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <title></title>
        <script type="text/javascript" charset="utf-8" src="bp-modal.min.js"></script>
        <link rel="stylesheet" href="modal.min.css" type="text/css" media="all" />
      </head>
      <body>
        <p data-modal="test" style="text-align:center">Click me!</p>
        <div class="modals" style="overflow: hidden;">
          <div id="test" class="modal modal-medium modal-closeable">
            <div class="modal-header">
              <h2>This is a Medium-Sized Modal</h2>
            </div>
            <div class="modal-content">
              <p>
                This modal includes the class <code>modal-closable</code> which adds
                the fancy close button at the top right.
              </p>
            </div>
          </div>
        </div>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
    	This modal includes the class <br><br><br>
      </body>
    </html>
    

     

  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    camarade
    ontedi
    ontedi's avatar
    Kayıt Tarihi: 04/Eylül/2005
    Erkek

    Modalın belirli bir yüksekliğe sahip olmasını sağlayabilirsin. İçerik o yükseklikten fazla olabilir o nedenle modal içerik kısmında overflow-y:scroll yapıp içeriği scrol ile gösterirsin.


    Matematikçi ve Yazılımcı. http://www.ontedi.com ve http://www.cizgi.site Siteme beklerim herkesi.
  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    adiga
    adiga's avatar
    Kayıt Tarihi: 09/Kasım/2020
    Erkek
    ontedi bunu yazdı

    Modalın belirli bir yüksekliğe sahip olmasını sağlayabilirsin. İçerik o yükseklikten fazla olabilir o nedenle modal içerik kısmında overflow-y:scroll yapıp içeriği scrol ile gösterirsin.

    hocam ben modal tıklandığında sayfa aşağı yukarı kaysın istemiyorum.

  4. KısayolKısayol reportŞikayet pmÖzel Mesaj
    wert
    wert's avatar
    Kayıt Tarihi: 19/Eylül/2005
    Erkek
    body:has(.modals-shown) {
      overflow: hidden;
    }

     


    |sadece aptalların başarısı ders notu ile ölçülür|
  5. KısayolKısayol reportŞikayet pmÖzel Mesaj
    adiga
    adiga's avatar
    Kayıt Tarihi: 09/Kasım/2020
    Erkek
    wert bunu yazdı
    body:has(.modals-shown) {
      overflow: hidden;
    }

     

    https://jsfiddle.net/9nw4t7xz/

     

    hocam denedim fakat olmadı. bakabilir misiniz.

  6. KısayolKısayol reportŞikayet pmÖzel Mesaj
    adiga
    adiga's avatar
    Kayıt Tarihi: 09/Kasım/2020
    Erkek
    wert bunu yazdı
    body:has(.modals-shown) {
      overflow: hidden;
    }

     

    yukarı yazınca düzeldi teşekkürler.

Toplam Hit: 249 Toplam Mesaj: 6
modal