简体   繁体   English

scrollabe jqm弹出窗口不起作用

[英]scrollabe jqm popup doesn't work

I am developing a jQuery Mobile project which i have an extendable popup in it but when i extent the text in the popup, it doesn't scroll. 我正在开发一个jQuery Mobile项目,其中有一个可扩展的弹出窗口,但是当我扩展弹出窗口中的文本时,它不会滚动。 I have checked overflow: scroll and all the other options in overflow, but none worked. 我已经检查了overflow: scrolloverflow: scroll所有其他选项,但没有一个起作用。 but when i extent the text i see a bar appears on the right side of the popup, but no scroll. 但是当我扩展文本时,我看到一个栏出现在弹出窗口的右侧,但没有滚动。

this is the last code i tried and did not work as well 这是我尝试过的最后一个代码,但效果不佳

$("#buttonTest").click(function() {
    $('#Popup').css('overflow', 'scroll');        
    $('#Popup').popup('open');
});

and this is the popup itself 这是弹出窗口本身

<div data-role="popup" id="Popup" data-transition="flow">
    <div class="newsCards">
        <img src="images/back.svg">
        <h4> header</h4>
        <div class="newsFader">
            <!-- extended text which is hidden at first -->
        </div>
    </div>
</div>

I tried to replicate your use case by creating the popup and styling it, the ideal way to make the test scrollable is by using css only. 我试图通过创建弹出窗口并设置其样式来复制您的用例,使测试可滚动的理想方法是仅使用css。 This is my scrollable newsFader class i took for the text container. 这是我用于文本容器的可滚动newsFader类。

<style type="text/css">
    .newsFader {
        width: 80%;
        height: 50px;
        overflow: scroll;
        margin-left: auto;
        margin-right: auto;
    }
</style>

Maybe the text was not scrolling beacuse the size of the container was not defined forcing it to adapt to its content. 可能是文本未滚动,因为未定义容器的大小,迫使其适应其内容。 Anyway this is the popup code i tried and scrolled correctly: 无论如何,这是我尝试并正确滚动的弹出代码:

<div data-role="popup" id="Popup" data-transition="flow">
    <div class="newsCards">
        <img src="">
        <h4> header</h4>
        <div class="newsFader">
            <!-- extended text which is hidden at first -->
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
            tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
            quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
            Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
            fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
            qui officia deserunt mollit anim id est laborum.
        </div>
    </div>
</div>

I hope it helps you, Happy Coding! 希望对您有帮助,快乐编码!

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

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