[jQuery] Re: Thickbox Reloaded strange problem

2007-05-25 Thread Su

Klaus, I can't follow everything in your explanation below, but it sounds a
lot more complicated than something I just noticed.

Rodrigo's TB declaration reads:
$('div.slot a').thickbox();
...and that applies exactly to the original link in the actual HTML. Also,
if I make a copy of the original div, both of the original HTML links
continue working, though the JS-generated links fail, as has been shown.

When the "add a trigger" link creates a new one, the div created has /two/
classes "slot new" and these aren the links that produce the empty TB
window.

BUT, I removed the "new" class from the generated links and everything
suddenly worked perfectly.
It doesn't actually explain anything directly, but it does seem wrong. From
what I can gather of your comments, what I just described shouldn't have
fixed the problem.


On 5/25/07, Klaus Hartl <[EMAIL PROTECTED]> wrote:


Rodrigo, it's inline content, right?

What currently happens is this: When opening the Thickbox this content
gets captured in a closure and never gets reappended back to its
original location - it is appended to the modal with appendTo, e.g. it
is moved in the DOM. But when the modal gets closed it is emptied
without restoring the content to its origin.

If you then add another Thickbox handler which refers to the same
content, this content is already empty if you've opened the Thickbox
with that content before from another handler.

I don't want to clone the content, because I want to preserve existing
event handlers. I didn't restore the content, because (until now) it
worked the way it is, so I was fine with it. I have never thought about
the case you're talking of, so I will have to think of a way to solve
this.

I guess I need to restore the content when closing the Thickbox...


-- Klaus



[jQuery] Re: Thickbox Reloaded strange problem

2007-05-25 Thread Su

And of course, now I can't seem to duplicate this.
IGNORE

On 5/25/07, Su <[EMAIL PROTECTED]> wrote:


Klaus, I can't follow everything in your explanation below, but it sounds
a lot more complicated than something I just noticed.

Rodrigo's TB declaration reads:
$('div.slot a').thickbox();
...and that applies exactly to the original link in the actual HTML. Also,
if I make a copy of the original div, both of the original HTML links
continue working, though the JS-generated links fail, as has been shown.

When the "add a trigger" link creates a new one, the div created has /two/
classes "slot new" and these aren the links that produce the empty TB
window.

BUT, I removed the "new" class from the generated links and everything
suddenly worked perfectly.
It doesn't actually explain anything directly, but it does seem wrong.
From what I can gather of your comments, what I just described shouldn't
have fixed the problem.


On 5/25/07, Klaus Hartl <[EMAIL PROTECTED]> wrote:

> Rodrigo, it's inline content, right?
>
> What currently happens is this: When opening the Thickbox this content
> gets captured in a closure and never gets reappended back to its
> original location - it is appended to the modal with appendTo, e.g. it
> is moved in the DOM. But when the modal gets closed it is emptied
> without restoring the content to its origin.
>
> If you then add another Thickbox handler which refers to the same
> content, this content is already empty if you've opened the Thickbox
> with that content before from another handler.
>
> I don't want to clone the content, because I want to preserve existing
> event handlers. I didn't restore the content, because (until now) it
> worked the way it is, so I was fine with it. I have never thought about
> the case you're talking of, so I will have to think of a way to solve
> this.
>
> I guess I need to restore the content when closing the Thickbox...
>
>
> -- Klaus
>




[jQuery] Re: Thickbox Reloaded strange problem

2007-05-25 Thread Rodrigo Moraes


On 5/25/07, Klaus Hartl wrote:

What currently happens is this: When opening the Thickbox this content
gets captured in a closure and never gets reappended back to its
original location - it is appended to the modal with appendTo, e.g. it
is moved in the DOM. But when the modal gets closed it is emptied
without restoring the content to its origin.


Ah, I got it. Thanks for the explanation. I tried to find where this
happens but I was a bit lost.


I don't want to clone the content, because I want to preserve existing
event handlers. I didn't restore the content, because (until now) it
worked the way it is, so I was fine with it. I have never thought about
the case you're talking of, so I will have to think of a way to solve this.


I have several places where this happens. Here's one usage: a form
inside a Thickbox which changes the values depending on which link
opens the thickbox. Then I add another block to the page and it also
has the same thickbox triger, etc. I don't need a lot of repeated
forms in the dom, just one, and them I change their values onShow.

thanks again for the explanation and the great Thickbox Reloaded,
-- rodrigo


[jQuery] Re: Thickbox Reloaded strange problem

2007-05-25 Thread Klaus Hartl


Rodrigo Moraes wrote:

Another issue with Thickbox Reloaded is that, if you want to load a
iframed content which is on the same domain/port, you won't be able
because if it's on the same domain it will guess that you want ajax
(and this is not always true). I hacked it again to force an iframe
even when it's on the same domain, if a config is set.


I think I will also add an overriding mechanism, probably pretty much 
the same as you already did...



-- Klaus




[jQuery] Re: Thickbox Reloaded strange problem

2007-05-25 Thread Rodrigo Moraes


On 5/25/07, Scott Sauyet wrote:

Sorry, I've looked at it a bit, and have absolutely no idea.  It is very
strange.  Sorry to have nothing to offer; I just didn't want you to feel
ignored.  Good luck,


Thanks. :)

As I'm not familiar with the internals of Thickbox Reloaded, I've
added a dirt hack to make that example work: an extra parameter
'content' was added and I set $('#content') explicitly when
initializing it. Then inside Thickbox I check to see if content is
already set.

As someone pointed on the IRC channel, it seems that the #content box
is moved from dom to memory when the script starts, and then the
dynamically added thickboxes don't have it available anymore. I tried
but couldn't find in the code where this happens.

Another issue with Thickbox Reloaded is that, if you want to load a
iframed content which is on the same domain/port, you won't be able
because if it's on the same domain it will guess that you want ajax
(and this is not always true). I hacked it again to force an iframe
even when it's on the same domain, if a config is set.

Thanks again. If you think it is worth, I'll fill an issue to report these.

-- rodrigo


[jQuery] Re: Thickbox Reloaded strange problem

2007-05-25 Thread Klaus Hartl


Rodrigo Moraes wrote:


Hi,
I have a problem with Thickbox contents not being loaded when the
trigger is set dynamically. Here's an example:

  http://dev.tipos.com.br/jquery/thickbox.php

1. Click on 'add a new thickbox trigger'.
2. Click on the new link to open the ThickBox. It will open and the
content will be set normally.
3. Repeat step 1. The new link will open a Thickbox which is empty.

Any clues why this is happening?

thanks,
rodrigo



Rodrigo, it's inline content, right?

What currently happens is this: When opening the Thickbox this content 
gets captured in a closure and never gets reappended back to its 
original location - it is appended to the modal with appendTo, e.g. it 
is moved in the DOM. But when the modal gets closed it is emptied 
without restoring the content to its origin.


If you then add another Thickbox handler which refers to the same 
content, this content is already empty if you've opened the Thickbox 
with that content before from another handler.


I don't want to clone the content, because I want to preserve existing 
event handlers. I didn't restore the content, because (until now) it 
worked the way it is, so I was fine with it. I have never thought about 
the case you're talking of, so I will have to think of a way to solve this.


I guess I need to restore the content when closing the Thickbox...


-- Klaus


[jQuery] Re: Thickbox Reloaded strange problem

2007-05-25 Thread Scott Sauyet


Rodrigo Moraes wrote:

I have a problem with Thickbox contents not being loaded when the
trigger is set dynamically. Here's an example: [ ... ]

Any clues why this is happening?



Sorry, I've looked at it a bit, and have absolutely no idea.  It is very 
strange.  Sorry to have nothing to offer; I just didn't want you to feel 
ignored.  Good luck,


  -- Scott