diff --git a/README.md b/README.md index 91a02c2..ee326ae 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # mresize -Event based jQuery element resize +Event based jQuery element resize + +[Origin version](https://github.com/malihu/mresize) The plugin does not use any kind of timer(s) to detect size changes. It uses the resize event on (invincible) iframe(s) which makes it perform much better than other solutions which use timers to poll element size. The script detects size changes made from JS, CSS, animations etc. and it works on any element able to contain other elements (e.g. div, p, li etc.). To use it on other inline elements (e.g. images) you need to add a wrapper and call the event on it. @@ -13,8 +15,16 @@ npm: `npm install mresize` $(selector).on("mresize",function(){ console.log($(this)); }); + +$(selector).on("mresizeind",function(){ + console.log($(this)); +}); ``` +### Updates + +event ```mresizeind``` watch size chages with margins and paddinds not only height and width change. + #### For more information * [Plugin homepage and documentation](http://manos.malihu.gr/event-based-jquery-element-resize/) diff --git a/mresize.js b/mresize.js index 2a232a0..3713f0c 100644 --- a/mresize.js +++ b/mresize.js @@ -67,5 +67,34 @@ THE SOFTWARE. $(this).removeData("mresize").find(".resize").remove(); } }; + + $.event.special.mresizeind={ + add:function(){ + console.log(arguments); + var el=$(this); + + if(el.data("mresizeind")) return; + if(el.css("position")==="static") el.css("position","relative"); + el + .append("