Log in

View Full Version : LBGW AJAX deactivate alternative



burnside
11-04-2009, 12:02 PM
Hi,

Am using LBGW with AJAX content and need to know how to make the equivalent of :



<a href="#" class="lbAction" rel="deactivate" >


have tried


<a href="#" class="lbAction" rel="deactivate" onmouseover="if(!this.onclick)new lightbox(this);">


please help

jscheuer1
11-04-2009, 05:31 PM
The javascript command to deactivate is:


lightbox.prototype.deactivate();

But you might want to use (from the instructions) instead:


Linking to a Another Lightbox within a Lightbox

If you want to load a different lightbox within an already open lightbox set the rel attribute to insert and your href to the file you want to load instead.


<a href="confirm.html" class="lbAction" rel="insert">Go to Another Lightbox</a>


The reason being that you have to be careful what events and in what order you assign to a link that you give (at any point) lightbox control over - it may overwrite them (in which case they won't fire at all), or the order in which you do things may need to be other than you may at first imagine (in which case the result may be other than expected), better to let lightbox handle things if at all possible.

burnside
11-09-2009, 02:13 PM
...thanks used onclick with



lightbox.prototype.deactivate();


as this content is created by an AJAX call the rel tags arent picked up
by LBGW script... i think ;-)

thanks again MG

jscheuer1
11-09-2009, 03:50 PM
Glad you're apparently satisfied, but it occurs to me that once your onmouseover event fires, the hardcoded onclick event of the link will be overwritten. If I'm right about that, you never needed the onclick to begin with.

And further though, that if you are still using:



onmouseover="if(!this.onclick)new lightbox(this);"

Your onmouseover event won't fire.

But perhaps you no longer needed the mouseover event because all you wanted was to close the lightbox. In which case I completely understand.