Update Plugin When Div is Resized...

Update Plugin When Div is Resized...

Hi guys,

I've made a custom plugin that fills a div with text - as big as it can be (based on fittext) - it works the way I want - except for one thing...

You call the plugin like this:

  1.  $(".lotsOfDivs").myPlugin("% fill","% from top");

At the bottom of the plugin I've got this line:

  1. $(window).on('resize.myplugin orientationchange.myplugin', resizeText);


If I have a div ("big") that is 100% width and height of the body - and I call the plugin like this:

  1. <div class="big">
  2. <div class="item">My Text</div>
  3. </div>

Then I use my plugin like this:

  1.  $(".item").myPlugin(100,0);

That works fine - if I resize or change the browser - the text resizes to fit the box.

BUT...

If I don't resize the browser - and do the following:

  1. $(".big").width("50%");
  2. $(".big").height("50%");


My plugin isn't called - as it only loads when the browser is resized. So my text is the wrong size.


So what I need is a way to "update" the function. Like...

  1. $(".item").myPlugin().update()

or a way to update all elements that are using the plugin.

  1. myPlugin.updateAll()

  

Thanks for any help.