简体   繁体   English

模态增长时如何扩展模态背景?

[英]How to extend modal background when modal grows?

Similar question: 类似的问题:

Modal dialog- How to get modal's background to extend 100% with scrolling? 模态对话框-如何通过滚动获取模态背景以扩展100%?

With bootstrap when you show a modal it covers the rest of the screen's content with a gray background. 使用引导程序显示模态时,它会以灰色背景覆盖屏幕的其余内容。 However, if you show a modal, and then add contents to that modal until it extends below the bottom of the visible window, when you scroll down to view this content, the gray background does not extend below the original size of the modal. 但是,如果显示模态,然后将内容添加到该模态,直到其延伸到可见窗口底部下方,当您向下滚动以查看此内容时,灰色背景不会延伸到模态的原始尺寸以下。 Instead you see gray background down to the size of the window, and then the regular background color for the site below that. 取而代之的是,您看到的灰色背景会缩小到窗口大小,然后会看到其下方站点的常规背景色。

Is there a way to make this gray background grow when the modal grows? 当模态增加时,是否有办法使灰色背景增加?

You must call .data('bs.modal').handleUpdate(); 您必须调用.data('bs.modal').handleUpdate(); on your modal element while adding your dynamic content. 在添加动态内容时将其放在模式元素上。

Example: 例:

function addContent() { // add dynamic content $('.modal-body').append('<p>lorem ipsum...</p>'); // update modal backdrop $('.modal').data('bs.modal').handleUpdate(); }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM