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

时间:2011-07-04 10:42:11

标签: jquery html

我使用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;

2 个答案:

答案 0 :(得分:10)

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

div的CSS:

#result-dialog{
    height: 300px;
    overflow: auto; /* Or scroll, depending on your needs*/
    width: 300px;
}

编辑:Here it is具有可滚动内容的jquery dialog的工作示例。有关对话框的更多属性和样式,请查看其page

在你的HTML中你应该包括:

jQueryjQuery UIjQuery UI CSS(这些是Google CDN的热门链接 - 如果您希望自己可以从jquery的主页下载这些内容)

答案 1 :(得分:1)

你想要这个css属性吗?

Scrollable div

您必须设置特定div的溢出和高度