【问题标题】:trying to make a div resize height automatically depending on how much content there is in a containing div尝试根据包含的 div 中有多少内容自动调整 div 的高度
【发布时间】:2012-05-31 04:59:26
【问题描述】:

当另一个 div (.column.c) 的内容在或多或少之间发生变化时,我正在尝试自动调整 div (.bottom) 的大小。

我猜我需要使用 jquery,但我不知道从哪里开始。如果能顺利调整大小就好了!

我正在使用我创建的内容类型的 drupal 和视图幻灯片。

干杯,伙计们。

【问题讨论】:

    标签: jquery drupal html height resize


    【解决方案1】:

    试试这个:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript">
        $(function() {
            $(".bottom").height($(".column.c").height());
        });
    </script>
    

    您需要将此代码放在更改.column.c div 大小的任何事件下。

    【讨论】:

    • 对不起,我根本不懂 jquery。
    • 没有什么改变 .column.c div 的大小,它只是有更多或更少的文本。
    • 感谢您的回复,它似乎仍然无法正常工作。如果有帮助,该网站地址是 2012.qdos.co。
    猜你喜欢
    • 1970-01-01
    • 2012-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    • 2015-11-03
    相关资源
    最近更新 更多