Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set jquery ThickBox size to auto

I use JQuery ThickBox 3.1 to show my Iframed Content as popup window .

 <a href="popUp.aspx?id=<%#Eval("id")%>&TB_iframe=true&height=600&width=800" 
 title='<%#Eval("Title")%>' class="thickbox">
 <img id="thumbnailImage" runat="server" src='<%#Eval("ImagePath")%>' 
 alt="Single Image"  width="180" style="max-height:220px"/></a></div>

When I click 'thumbnailImage' , the page 'popUp.aspx' will show as a popup window .
As you see , i give the size of popup window to height=600&width=800" ,
but I have a table with( width:auto ) , thus the width of my table may change dynamically !

I want to know how to set the value of thickBox's width and height to auto .

You can see thickBox's css file and javascript file !

like image 556
zey Avatar asked May 11 '13 07:05

zey


1 Answers

Not sure if I understood everything correctly, but if your table is inside an iframe you have to know that an iframe is a boundary for many things in your page.

In particular, layout doesn't flow through an iframe. There's the inside of the iframe and the outside. They leave in completely separated worlds and there is no way that the size of your table (which lives in the document inside the iframe) can influence the size of the iframe itself -- or anything that lives in the document outside the iframe.

If you don't get rid of the iframe your only solution is to use javascript to copy the size from the document inside the iframe to the iframe itself. Of course, this is assuming a script is allowed to do that, i.e. you don't have cross-site scripting issues (your iframe and the main document must come from the same origin).

For clarification and to properly answer: you ask the wrong question. Setting thickbox size to 'auto' will not help you. You must set thickbox size to the actual value dynamically.

like image 78
jods Avatar answered Sep 30 '22 04:09

jods