开发者

javascript resize with mouse

开发者 https://www.devze.com 2023-04-08 15:06 出处:网络
I\'d like to l开发者_如何学运维et my users resize a div from the 4 corners or the 4 sides with the mouse.

I'd like to l开发者_如何学运维et 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


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消