views:

316

answers:

2

Hi,

I'm using the Boxy jQuery plugin to open dialog windows and populating it through ajax. http://onehackoranother.com/projects/jquery/boxy/

Here's my code so far:

$("a.create").click(function (e) {
  url = $(e.target).attr('href');
  Boxy.load(url, {title:'Test'});
});

This opens up a dialog alright. However, if I click the link again, another dialog will open. How can I make it such that the previously opened Boxy dialog will come into focus? I only want one instance of this dialog.

I tried assigning a variable to var ele = Boxy.load(); but the variable ele returns undefined... Alas, I can't make out much from the limited Boxy documentation available.

Enabling the option modal: true would prevent the user from clicking on the link multiple times, but I don't want the overlay to show.

Thanks for any light you can shed on this.

-Lyon

A: 

Just edit Boxy's CSS file to take away the overlay.

.boxy-modal-blackout { position: absolute; background-color: none; left: 0; top: 0;}

Rob
A: 

I decided to use a variable to identify if the boxy dialog has been opened. If it has, do nothing. Not an elegant solution though...

var dialog = false;
$("a.create").click(function () {
  if (!dialog) {
    dialog = new Boxy.load(this.href, {
      title: 'Test',
      afterHide: function() { dialog = null; },
    });
    return false;
  }
});
Lyon