如何在jquery中创建具有固定高度的可滚动对话框?

kot*_*oti 2 html jquery

我使用jquery ajax函数请求一些数据.我必须在jquery可滚动对话框中显示请求的数据我该怎么做.我在这里使用code.for请求数据.

$('#load').show();
        $.ajax({
            type: "POST",
            url: "push/push_notify.php",
            data: "pushmessage="+message+"&iphone="+iphone+"&android="+android+"&blackberry="+blackberry,

            success: function(e){
                $('#load').hide();
                var response =e;

               $("#showtable").fadeOut('slow').load("alerttable.php").fadeIn('slow');
            }
        });
       return false;
Run Code Online (Sandbox Code Playgroud)

Mat*_*yas 10

您可以使用jQuery UI中的对话框,容器div元素应具有固定的宽度和高度,溢出设置为scroll(滚动条始终显示)或auto(需要时显示滚动条).

div的CSS:

#result-dialog{
    height: 300px;
    overflow: auto; /* Or scroll, depending on your needs*/
    width: 300px;
}
Run Code Online (Sandbox Code Playgroud)

编辑:这是一个带有可滚动内容的jquery对话框的工作示例.有关对话框的更多属性和样式,您应该查看其页面.

在您的HTML中,您应该包括:

jQuery,jQuery UIjQuery UI CSS(这些是来自谷歌CDN的热门链接 - 如果你希望你可以从jquery的主页上自行下载这些内容)