Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 拉伸div,但不是整个页面_Javascript_Jquery_Css - Fatal编程技术网

Javascript 拉伸div,但不是整个页面

Javascript 拉伸div,但不是整个页面,javascript,jquery,css,Javascript,Jquery,Css,我有一个动态高度的框架。 其中,我有3个部分,其中一个是内容部分 我想将内容的边缘固定到距帧恒定的距离 这是。我在小提琴中使用jQueryUI对话框只是因为它在再现问题时更容易使用。解决方案不能涉及jquery ui对话框特定的代码。但它可以使用jquery和jquery ui 如果存在CSS解决方案,则更好 定位元素更容易解决您描述的问题。例如,您可以使用position:absolute。然后使用“上”、“右”、“下”和“左”属性,可以将元素定位到需要的位置。下面是一个css示例: #con

我有一个动态高度的框架。 其中,我有3个部分,其中一个是内容部分

我想将内容的边缘固定到距帧恒定的距离

这是。我在小提琴中使用jQueryUI对话框只是因为它在再现问题时更容易使用。解决方案不能涉及jquery ui对话框特定的代码。但它可以使用jquery和jquery ui

如果存在CSS解决方案,则更好


定位元素更容易解决您描述的问题。例如,您可以使用position:absolute。然后使用“上”、“右”、“下”和“左”属性,可以将元素定位到需要的位置。下面是一个css示例:

#content {
    border: 1px solid blue;
    bottom: 34px;
    top: 34px;
    left:10px;
    right:10px;
    position: absolute;
}
#footer {
    border: 1px solid green;
    bottom: 10px;
    left:10px;
    right:10px;
    position: absolute;
}

演示:

定位元素更容易解决您描述的问题。例如,您可以使用position:absolute。然后使用“上”、“右”、“下”和“左”属性,可以将元素定位到需要的位置。下面是一个css示例:

#content {
    border: 1px solid blue;
    bottom: 34px;
    top: 34px;
    left:10px;
    right:10px;
    position: absolute;
}
#footer {
    border: 1px solid green;
    bottom: 10px;
    left:10px;
    right:10px;
    position: absolute;
}
演示:

您需要应用alsoResize选项。。。然后,您的内容将与容器同时增长

引述:

Resize these elements synchronous when resizing.

Code examples

Initialize a resizable with the alsoResize option specified.
$( ".selector" ).resizable({ alsoResize: ".other" });
Get or set the alsoResize option, after init.
//getter
var alsoResize = $( ".selector" ).resizable( "option", "alsoResize" );
//setter
$( ".selector" ).resizable( "option", "alsoResize", ".other" );
来源:

您需要应用alsoResize选项。。。然后,您的内容将与容器同时增长

引述:

Resize these elements synchronous when resizing.

Code examples

Initialize a resizable with the alsoResize option specified.
$( ".selector" ).resizable({ alsoResize: ".other" });
Get or set the alsoResize option, after init.
//getter
var alsoResize = $( ".selector" ).resizable( "option", "alsoResize" );
//setter
$( ".selector" ).resizable( "option", "alsoResize", ".other" );

来源:

这是一个非常好的答案,但它仍然假设标题只有一行。。不管标题的高度如何,有什么解决方法吗@guymograbi您可以使用jquery动态设置内容的top属性的值。例如:$content.css'top',$'title'。高度+12;当然,使用这种方法,您必须为对话框设置默认高度。这是一个非常好的答案,但它仍然假设标题只有一行。。不管标题的高度如何,有什么解决方法吗@guymograbi您可以使用jquery动态设置内容的top属性的值。例如:$content.css'top',$'title'。高度+12;当然,使用这种方法,你必须为你的对话框设置一个默认高度。你太棒了!我希望我有一个CSS解决方案,但我怀疑它是否存在。我为那些感兴趣的人设计了一套你的解决方案。我很高兴它能工作,是的,你可以使用css,基于@Sotiris加上一些mod的良好评论,但是由于你使用jQ+UI,你只需要在代码中添加一行就可以了。。。正如我们在你的例子中所看到的-你太棒了!我希望我有一个CSS解决方案,但我怀疑它是否存在。我为那些感兴趣的人设计了一套你的解决方案。我很高兴它能工作,是的,你可以使用css,基于@Sotiris加上一些mod的良好评论,但是由于你使用jQ+UI,你只需要在代码中添加一行就可以了。。。正如我们在你的例子中所看到的-