I am using jquery‘s thickbox 3.1 for an image gallery. My problem started because the previous developer made the site using iframes. I strong recommend you not using iframes or frames, and there are many reasons for you to not using them.
Of course this is a hack, and the best scenario you shouldn’t use frames and then do the coding in “perfect” manner.
In order to make the thickbox work inside an iframe you must do the following:
1 – Add jquery and thickbox files to both main and iframe pages. This is required so the previous and next link works on the inline popup (thickbox).
2 – Make the following changes to the thickbox.js file
2.1. – Replace the code inside the function tb_init(domChunk) tb_show(t,a,g); to self.parent.tb_show(t,a,g,window);
2.2. – Replace
function TB_show(caption, url, imageGroup)
to
function TB_show(caption, url, imageGroup, refWindow)
2.3. – Replace
TB_TempArray = $(“a[@rel=”+imageGroup+”]”).get();
to
TB_TempArray = refWindow.$(“a[@rel=”+imageGroup+”]”).get();
2.4. – Replace
tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
to
tb_show(TB_PrevCaption, TB_PrevURL, imageGroup, refWindow);
2.5. – Replace
tb_show(TB_NextCaption, TB_NextURL, imageGroup);
to
tb_show(TB_NextCaption, TB_NextURL, imageGroup, refWindow);
3 – Now the code for your links must be something like this:
That’s all you need. It took me while to figure this out. On the internet I found some information but it was confusing so I decided to compile everything in one post. I hope this helps anyone looking to do the same.