Code example of the div resize event under jquery

Source: Internet
Author: User

This article mainly introduces the resize event of the div under jquery written by a great God. For more information, see

This is the resize event of the div under jquery written by a great god. The Code is as follows: // resize of div (function ($, h, c) {var a = $ ([]), e = $. resize = $. extend ($. resize, {}), I, k = "setTimeout", j = "resize", d = j + "-special-event", B = "delay ", f = "throttleWindow"; e [B] = 250; e [f] = true; $. event. special [j] = {setup: function () {if (! E [f] & this [k]) {return false;} var l = $ (this); a =. add (l); $. data (this, d, {w: l. width (), h: l. height ()}); if (. length = 1) {g () ;}, teardown: function () {if (! E [f] & this [k]) {return false;} var l = $ (this); a =. not (l); l. removeData (d); if (! A. length) {clearTimeout (I) ;}, add: function (l) {if (! E [f] & this [k]) {return false;} var n; function m (s, o, p) {var q = $ (this ), r = $. data (this, d); r. w = o! = C? O: q. width (); r. h = p! = C? P: q. height (); n. apply (this, arguments);} if ($. isFunction (l) {n = l; return m;} else {n = l. handler; l. handler = m ;}}; function g () {I = h [k] (function () {. each (function () {var n = $ (this), m = n. width (), l = n. height (), o = $. data (this, d); if (m! = O. w | l! = O. h) {n. trigger (j, [o. w = m, o. h = l]) ;}}); g () ;}, e [B]) ;}} (jQuery, this ); in this way, You Can $ ('div '). resize (fucntion (){..}); now

Related Article

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.