Friday, April 29, 2011

JQuery Boxy plugin resize and access

How exactly does one resize a Boxy.load()? I can resize using: var tmp = new Boxy(); tmp.resize(40,40);

But if I then try to use tmp.load('somefile.php'); it states that tmp.load is not a function. I've also tried:

var tmp = Boxy.load('somefile.php'); tmp.resize(100,100); // Says that tmp.resize is not a function.

How can I resize a boxy window after it has been created using Boxy.load(). Thanks in advance.

From stackoverflow
  • I read through the documentation and I think I get it:

    http://onehackoranother.com/projects/jquery/boxy/

    Basically, you need to set a callback in the afterShow option for Boxy.load.

    Boxy.load() does not return an instance because it's an ajax call, so it returns immediately but can't draw anything, so it's pointless to hand back a Boxy instance. So, in your callback, you'll have full access to the whole Boxy object and you'll be able to call resize. It looks like this:

    Boxy.load("whereever.html", {
      afterShow: function() {
        this.resize(40,40);
      }
    });
    

    Tada! I tested it, it seemed to almost do the trick. It didn't quite handle vertical resizing very well, but horizontal was what I sort of expected. (but I was trying to cram a lot of stuff into the window, so it's likely that it just re-resized it to fit the content.

  • erewreewewe gdsfsdf rgfdg fggfdg ggg fgfg gsdgdgd

0 comments:

Post a Comment