javascript用鼠标调整大小

时间:2011-09-27 17:53:08

标签: javascript html resize mouse

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

我只想使用Javascript,请不要使用JQ库...

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

由于

1 个答案:

答案 0 :(得分:3)

使用CSS3 resize: both;,如下所示: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>