1

我对javascript的了解很少,所以这似乎是一个非常基本的问题,但找不到解决方法。

我有一个 1024*768 的固定区域,如下所示:

替代文字 http://img260.imageshack.us/img260/4618/myimage.png

在“A 部分”的右侧会有一个 javascript 按钮。当我单击该按钮时,A 部分将自动调整大小,如下所示:

替代文字 http://img705.imageshack.us/img705/92/myimage1.png

因此,A 部分将与 B 部分重叠,并且与 C 部分的大小相同(我知道 C 部分的大小)。如何使用重叠功能自动调整该区域的大小?我正在寻找 Jquery 的插件,但找不到。Jquery 中有一个可调整大小的函数,但它对我没有帮助。你能帮帮我吗?(如果您只是给我一个与此功能相关的链接,那也足够了)

编辑:额外说明,A 部分是一个 Flash 对象,因此当我单击该按钮时,它会放大并与 B 部分重叠。

谢谢,

4

3 回答 3

0

像这样的东西:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Terminal</title>
        <script src="/js/jquery-1.3.2.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                $('#but').click(function (e) {
                    $('#a').removeClass('big').addClass('normal');
                    $('#b').hide();
                    e.preventDefault();
                });
            });
        </script>
        <style type="text/css">
            .height {
                height: 100px;
                border: 1px solid black;
            }

            .big {
                width: 198px;
                float: left;
            }

            .small {
                width: 100px;
                float: left;
            }

            .normal {
                width: 300px;
                clear: both;
            }
        </style>
    </head>
    <body>
        <div><a href="#" id="but">button</a></div>
        <div id="a" class="height big">a</div>
        <div id="b" class="height small">b</div>
        <div class="height normal">c</div>
    </body>
</html>
于 2009-12-04T12:18:22.033 回答
0

jQueryhide()效果在这里很有用。如果 Section A 和 Section B 都有一个float: leftSection A应该在 Section B 隐藏时扩展以填充该区域。

http://docs.jquery.com/Effects/hide

于 2009-12-04T05:10:57.047 回答
0

您是否尝试过动画功能? http://docs.jquery.com/Effects/animate

可以让 B 部分用幻灯片隐藏,或者像你提到的那样让 A 部分重叠,只需要正确设置定位、z-index 等。

于 2009-12-04T05:15:49.737 回答