EasyUI series Learning (5)-Resizable (resize), easyui-resizable

Source: Internet
Author: User

EasyUI series Learning (5)-Resizable (resize), easyui-resizable

I. Create Components

1. Use tags to create a variable-size window

<div id="rBox" class="easyui-resizable" style="width: 200px; height: 100px; left: 100px; background:cyan"></div>

2. Use JavaScript to create a variable-size window

<div id="rBox" style="width: 200px; height: 100px; left: 100px; background:cyan"></div><script>    $(function () {        $("#rBox").resizable();    });</script>

Ii. Attributes

1. disabled: if it is true, the size adjustment is disabled.

<div id="rBox" style="width: 200px; height: 100px; left: 100px; background:cyan"></div><script>    $(function () {        $("#rBox").resizable({            disabled: true        });    });</script>

2. handles: handle default value: n, e, s, w, ne, se, sw, nw, all

<Div id = "rBox" style = "width: 200px; height: 100px; left: 100px; background: cyan"> </div> <script >$ (function () {$ ("# rBox "). resizable ({// indicates that the arrow handles: "se"}) ;}appears in the southeast direction of the mouse. </script>

3. minWidth, minHeight, maxWidth, and maxHeight

<Div id = "rBox" style = "width: 200px; height: 100px; left: 100px; background: cyan"> </div> <script >$ (function () {$ ("# rBox "). resizable ({// adjustable min width: 150, // adjustable min Height: 80, // adjustable max width: 500, // you can adjust the maximum hitting height. maxHeight: 200}) ;}); </script>

4. edge: Set the edge size (the operation is effective only when padding is understood as <= 50)

<div id="rBox" style="width: 200px; height: 100px; left: 100px; background:cyan"></div> <script>     $(function () {         $("#rBox").resizable({             edge: 50         });     }); </script>

Iii. Events

1. onStartResize: triggered when the size is changed

<Div id = "rBox" style = "width: 200px; height: 100px; background: cyan"> </div> <script >$ (function () {$ ("# rBox "). resizable ({onStartResize: function (e) {console. log ("trigger once when moving") ;}};}); </script>

2. onStopResize: triggered when the stop changes the size

<Div id = "rBox" style = "width: 200px; height: 100px; background: cyan"> </div> <script >$ (function () {$ ("# rBox "). resizable ({onStartResize: function (e) {console. log ("trigger once when moving");}, onStopResize: function (e) {console. log ("triggered every time you press the mouse, triggered once when you stop moving") ;}); </script>

3. onResize: triggered during resizing. When false is returned, the DOM element size is not actually changed.

<Div id = "rBox" style = "width: 200px; height: 100px; background: cyan"> </div> <script >$ (function () {$ ("# rBox "). resizable ({onStartResize: function (e) {console. log ("trigger once when moving");}, onStopResize: function (e) {console. log ("triggered every time you press the mouse, triggered once when you stop moving") ;}, onResize: function (e) {console. log ("always triggered during adjustment"); // return false ;}}) ;}); </script>

Iv. Methods

1. options: return the resize attribute

2. enable: enable the resize function.

3. disable: disable the resize function.

5. Override the default object

<div id="rBox" style="width: 200px; height: 100px; background:cyan"></div><script>    $(function () {        $.fn.resizable.defaults.maxHeight = 500;        $("#rBox").resizable({        });    });</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.