javascript 用鼠标调整大小

发布于 2024-12-06 12:59:24 字数 121 浏览 2 评论 0原文

我想让我的用户用鼠标从 4 个角或 4 个边调整 div 的大小。

我希望只使用 Javascript,不要使用 JQ 库...

右下角的一个微小的调整大小图像将是一个优点!

谢谢

I'd like to let my users resize a div from the 4 corners or the 4 sides with the mouse.

I whish to use just Javascript, no JQ library please...

A tiny little resize image in the right bottom corner would be a plus!

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最单纯的乌龟 2024-12-13 12:59:24

使用 CSS3 resize: Both;,如下所示:http://dhtmlexamples.com/2011/01/20/creating-a-user-ressized-div-tag-using-css3/

<style type="text/css">
    .isResizable {
        background: rgba(255, 0, 0, 0.2);
        font-size: 2em;
        border: 1px solid black;
        overflow: hidden;
        resize: both;
        width: 160px;
        height: 120px;
        min-width: 120px;
        min-height: 90px;
        max-width: 400px;
        max-height: 300px;
    }
</style>

<div class="isResizable">The quick brown fox jumps over the lazy dog.</div>

Use CSS3 resize: both;, as seen here: http://dhtmlexamples.com/2011/01/20/creating-a-user-resizable-div-tag-using-css3/

<style type="text/css">
    .isResizable {
        background: rgba(255, 0, 0, 0.2);
        font-size: 2em;
        border: 1px solid black;
        overflow: hidden;
        resize: both;
        width: 160px;
        height: 120px;
        min-width: 120px;
        min-height: 90px;
        max-width: 400px;
        max-height: 300px;
    }
</style>

<div class="isResizable">The quick brown fox jumps over the lazy dog.</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文