Have you ever wished of doing something more with what you have been doing with jQuery thickbox? Now it has been more then 6 months that I am using jQuery on different projects. I have extended jQuery many a times during this period and to tell you one thing I have used jQuery for heavy-weight form processing for one of my very complicated project and it included processing of more then 1600 html controls with the help of great jQuery.
Now when it comes to Thickbox it gives nice functionality but many a times it leaves us hungry for more. For example here are the few situations where it will be difficult to use Thickbox without further modification.
- It let's open window in a IFRAME and close that but what if you can't give 'class="Thickbox"' to any of your link?
- What if you are not loading those links with page load? (If the links from which you are willing to open Thickbox windows is not available at the time of page load then Thickbox won't work. As Thickbox internally works in a way that it will search for all links with class = "Thickbox" at the time of page load and then customize their onclick events.)
- What if you want to open second Thickbox window as someone close first one and that too without any user interaction?
- What if you want to call any javascript function from the parent window? (parent window is the window from which parent window is getting opened.)
jQuery Thickbox is a great solution for many of our requirement but we don't have any option but to modify actual code to use them with complicated and advance situations which we come across.
I have done some modification in Thickbox.js to achive all above 4 points using Thickbox by adding 2 more functions into this great utility and modifying tb_remove function.
Here are 2 functions I have added, you can understand what they do once you read comments.
// To close one thickbox and then open another, this is quite handy // when you want to open another response modal window on the action of current modal window. // Opening more then one thickbox window is not possible on the same page, // so closing one and opening another could be quite handy and we can change height // and width as well for another window. var jThickboxNewLink; function tb_remove_open(reloadLink){ jThickboxReloadLink = reloadLink; tb_remove(); setTimeout("jThickboxNewLink();",500); return false; } // This function will let you open new thickbox window without specifying // class="Thickbox" and any href="http://web.com" attribute // It will be helpful when you are dynamically loading any content and // from those content you would like to open Thickbox windows. // As basically the nature of thickbox is such that it scans all links (..) tags // on load using jQuery's $(document).ready function so if your link is loaded using ajex // or using any dynamic javascript and was not on page at the time of load then this thickbox // setup won't work and you have to use this function. function tb_open_new(jThickboxNewLink){ tb_show(null,jThickboxNewLink,null); }
And here is the tb_remove function with minor modification which will let us call any function of the parent window passed as an argument.
// Modified to provide parent window's function callback function tb_remove(parent_func_callback) { $("#TB_imageOff").unbind("click"); $("#TB_closeWindowButton").unbind("click"); $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); $("#TB_load").remove(); if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 $("body","html").css({height: "auto", width: "auto"}); $("html").css("overflow",""); } if(parent_func_callback != undefined) eval("window."+parent_func_callback); document.onkeydown = ""; document.onkeyup = ""; return false; }
See Demo live in action or download zip with examples and modified javascript file.
Let me know if there are any other mods you have done with jQuery thickbox..! or if this post has helped you achieve what you wanted to do with jQuery Thickbox.
#1 by ali on April 29, 2008 - 3:07 pm
Quote
wow thats greate
i am using thick box in two or three of my applications and faced few of these 4 problems and solved them hardly by providing other alternatives of doing them
but having your modified thickbox will make my applications work better
thanks a lot
Pingback: Daily Find #62 | TechToolBlog
#2 by joe on May 20, 2008 - 4:05 am
Quote
i was having trouble closing a thickbox ajax popup window. apparently there are some compatibility issues with the new version of jQuery. i went to the thickbox support forums and could not find an answer that worked. i found your blog with a simple Google search. i added your tb_remove function with an onclick control and the window closed perfectly. thanks for this. i emailed cody, hopefully he will update thickbox with some of your modifications.
#3 by ibme_uk on May 25, 2008 - 5:41 am
Quote
Top man, used …
function tb_open_new(jThickboxNewLink){
tb_show(null,jThickboxNewLink,null);
}
Saved me a great deal of time and hassle, I was having problems using thickbox where the url’s were generated using ajax.. not a problem now..
Thanks.
#4 by john on May 29, 2008 - 9:34 am
Quote
Thanks for your tb_open_new function! I had been trying to find a way to do this. Is there any way to set the 'title' using that method?
#5 by banktip on June 5, 2008 - 4:34 pm
Quote
This is how you will close the thickbox and make refresh parent ?
// Modified to provide parent window's function callback
function tb_remove(parent_func_callback) {
$("#TB_imageOff").unbind("click");
$("#TB_closeWindowButton").unbind("click");
$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
$("#TB_load").remove();
if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
$("body","html").css({height: "auto", width: "auto"});
$("html").css("overflow","");
}
if(parent_func_callback != undefined)
eval("window."+parent_func_callback);
document.onkeydown = "";
document.onkeyup = "";
return false;
}
<a href ="" onclick="self.parent.tb_remove("parent_refresh_window");">Accept
actually that let me in the thickbox windows, and call a totally different page.
got a hint ?
#6 by Bill on June 14, 2008 - 8:25 pm
Quote
Can someone provide information on how to used the close and open new? The examples are no longer working.
#7 by Dharmavirsinh Jhala on June 20, 2008 - 4:22 am
Quote
Hi Bill,
jQuery thickbox examples are working now..!
please check it out at http://www.digitss.com/jquery/thickbox/thickbox_h…
Pingback: Настраиваем Thickbox - YoYurec Field
#8 by David Phipps on July 3, 2008 - 8:16 am
Quote
Hi,
I have used your modified version of thickbox and have found a possible bug and solution. In your modified tb_remove function the following line throws an error (missing ] in window object) in a non-modal thickbox when the 'close' link is clicked.
Here is the offending line of code:
eval("window."+parent_func_callback);
I have changed this to:
window[parent_func_callback]
and this seems to solve the problem.
Some great additions to thickbox by the way!!
Cheers,
Dave
#9 by Dharmavirsinh Jhala on September 7, 2011 - 12:30 am
Quote
Hi David,
I am replying you after long time but when I tried using "window[parent_func_callback]" instead of "eval(…)" code I was not able to call function which has arguments passed within. So this is something a matter of concern for those who wants to do that.
#10 by Dharmavirsinh Jhala on July 5, 2008 - 5:08 am
Quote
Hi David,
Thanks for your solution, actually I have used thickbox as modal window always in my application so never tried with non-modal version of it.
Thanks again.
Dharmavir
#11 by Andrew Robins on July 17, 2008 - 2:23 am
Quote
How can i load a thickbox when the page loads? without using the onload function either?
I have tried:
tb_open_new('TB_inline?height=300&width=400&inlineId=hiddenModalContent')
But it doesnt work. Anyone have any idea?
#12 by Andrew Robins on July 17, 2008 - 2:39 am
Quote
Now i am using this:
tb_open_new(#TB_inline?height=300&width=400&inlineId=hiddenModalContent');
but when i access the page i get the error:
Internet Explorer cannot open the Internet site
http://10.0.0.1/index.php?.
Operation aborted
Does anyone have any ideas why this isnt working?
#13 by Blacknight on August 15, 2008 - 12:18 pm
Quote
I was also wondering if you can change not only the width&height of a thickbox inside a iFrame, also changing the title for it.
It's too nasty remain the title "See the Image" even in a Contact Box…
#14 by Blacknight on August 16, 2008 - 6:52 am
Quote
Comm'on, somebody as to know!
#15 by ben on August 18, 2008 - 9:06 pm
Quote
I try to do 2 tweaks on a thickbox windows with HTML content, unfortunately I don’t find the way, I have already make a post on thickbox forum without success.
It’s really frustrating because this 2 tweaks are probably not complex to do.
Here what I want :
I want to display an HTML page using thickbox window but with a height of 1050 px or more (with no scrolling)
Actually the size seems to be locked at maximum to 450px in height.
How I can change the maxium height value ?
I want to use Thickbox to open an HTML page with some jpg images on it.
But I want to remove the preloading of the page (not only the animated gif but all the pre loading process) because in this case, when you clic on the thickbox link, instead to wait and see nothing, just the animated gif during the preloading, the page will load traditionally and you will see immediately the progressive jpg appear…
How I can remove the preloading function ?
If someone have a solution or an idea, please let me know.
Thanks to you,
#16 by Great Work buddy on September 5, 2008 - 10:44 pm
Quote
I must say this is what i was actually looking for.
I shifted to JQuery just few days back, leaving my then favorite MochiKit.
I admit, it was a nice shift for me.
And Thickbox was a bonus.
But it can leave you pretty much lost when you want to do something runtime, and if you trying to use
Thickbox, as an important step of your control/data flow.
People would know what crap am talking is not that much a crap.
Especially who are new to Thickbox like me.
But these changes made my way easier.
Thanks again for that.
#17 by sandya on September 9, 2008 - 8:22 pm
Quote
Hi,
When the php page load , i need "thick box popup" without clicking any tags.How to do it. can any one help me out. pls send sample code in php….
thanks
#18 by Dharmavirsinh Jhala on September 14, 2008 - 6:08 pm
Quote
Hi Sandya,
To open thickbox popup while page is loaded you don't need single line of php code.
Just write down following line of javascript on the page.
<script type="text/javascript">
$(document).ready(function(){
tb_open_new("http://www.yahoo.com/?TB_iframe=true&height=400&width=400&modal=true"
;
});
</script>
just specify your preferred web URL here and replace height and width with your preferred height and width..
Let me know if you need any further help.
#19 by Ryan on October 30, 2008 - 5:54 am
Quote
Dharmavirshnh Jhala,
I was hoping to use your code to not have to invoke the thickbox class but not for all the links on a site. Is there a way to just do it for specific links?
I am a novice at this stuff so I apologize if the question is too basic.
Thanks ahead of time for your help.
#20 by Dharmavirsinh Jhala on October 30, 2008 - 4:33 pm
Quote
Hi Ryan,
I thick I didn't got what you are trying to say, but I believe you don't need to hack thickbox, you can utilize thickbox as it is..
Please visit http://jquery.com/demo/thickbox/
click on Examples section and try various options you can see the demo.html code all the time for any example case to learn how you can implement that.
Actually if you don't want to have thickbox on all your links then just put class="thickbox" on only those links where you want thickbox to appear.
Please don't hesitate to ask further if I could help you out.
Thanks.
#21 by mick on November 4, 2008 - 6:20 pm
Quote
Grate work!
I was searching around for at least 4 hours until I found this article.
Thanx!!
#22 by HugLeo on November 18, 2008 - 3:27 pm
Quote
How can I show full size in a very large image?
#23 by wrzosw on November 25, 2008 - 7:48 pm
Quote
Is it possible to open a jpg without specifying the class attribute ??
thanks
#24 by Dharmavirsinh Jhala on November 26, 2008 - 10:05 am
Quote
We can open but then need to refer some ID/Class/Tag which can be triggered on load to find the elements and attach thickbox with them on their Click event…
#25 by Simone on December 13, 2008 - 8:29 am
Quote
Hi! I'm new to thickbox and jquery, and I have a problem without solution, so I ask to you a bit of help.
I need to open a thickbox on form submit, send all variables. For example: I have a search form that send parameters to a result page, and I need to open the result page in iframe with thickbox.
I try the solution on the thickbox forum without success.
Please, can you help me? Thank you very much!!!!!!
#26 by Igor Freire Rodrigue on December 16, 2008 - 9:20 pm
Quote
Hello. Blacknight, try this:
function tb_open_new(title,jThickboxNewLink){
tb_show(title,jThickboxNewLink,null);
}
So, when you call the function, pass the title as the 1st parameter: self.parent.tb_open_new('Your title…','window_one.html?TB_iframe=true….'
#27 by Igor Freire Rodrigue on December 17, 2008 - 9:21 pm
Quote
To submit forms, I've used this:
/* load the Form plugin */
/* function to submit form*/
$(function(){
$('#form_name').submit(function() {
data = this.formSerialize();
self.parent.tb_open_new('Window Title','process_form.php?&'+data+'TB_iframe=true&height=235&width=500')
return false;
});
});
#28 by pramod on January 10, 2009 - 3:25 am
Quote
i hv problem with thick box even i used these updated files, i m trying to call popup window n from that window im selecting particular value, n i hv to return on parent page with upadating some portion but problem is when i click on that popup windows link which i was using for further changes in parent page then only parent page displayed as it is without any change. please suggest me……!
#29 by shivank on January 15, 2009 - 11:31 pm
Quote
Thanks for your hack but it gives me one javascript error on mozilla error console.
Error: missing ] after element list
Source Code:
window.[object Object]
i.e for this line in the code(thick box js file)
eval("window."+parent_func_callback);
#30 by Yen-Wei Liu on February 9, 2009 - 7:21 pm
Quote
Hello,
As I tried to using tb_remove_open, which is not used in your demo, and found out it didn't work.
—-
var jThickboxNewLink;
function tb_remove_open(reloadLink){
jThickboxReloadLink = reloadLink;
tb_remove();
setTimeout("jThickboxNewLink();",500);
return false;
}
—
jThickBoxNewLink is merely defined as a var, and jThickboxReloadLink isn't defined anywhere either. Is there anything missing in the code?
ywliu
#31 by Avi on February 25, 2009 - 10:08 pm
Quote
Hi,
I nees some help. I got a list of urls loaded in ajax (onclick)so thick box doesn't see them, and I need the href= "' +entry.url + '".
I tried your solution but it didn't work.
Thanks.
#32 by Dharmavirsinh Jhala on February 26, 2009 - 5:25 am
Quote
@Avi,
You have two choices:
1) You can use Text or <a>Text
"tb_open_new" function you can find on my current blog post. (http://blogs.digitss.com/technology/hacking-jquery-thickbox/)
2) The other way is to put following line of code once you are done with your AJAX dom manipulation.
$.each( $("[class='someclass']), function(){
tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
imgLoader = new Image();// preload image
imgLoader.src = tb_pathToImage;
});
Which you can find on top of thickbox.js original file as well, although I did some modification. (instead of onready it's $.each here according to our circumstances)
and the 3rd and final way is:
3) Give some class to your links which you are loading using AJAX like following:
sometext
and then after your AJAX manipulation code place following code:
$.each( $("[class='dgclass']), function(){
tb_open_new($(this).attr("href"));
}
The third option is hybrid of 1st and 2nd.
I have just wrote code here in the comment box and not tested on browser but I believe it will work fine without little or no modification.
Let me know whether this helped or not?
#33 by Avi on February 26, 2009 - 5:56 am
Quote
Thanks a lot, I'll get back to you in a few days.
#34 by Avi on February 28, 2009 - 4:19 am
Quote
Hi again, well slowly slowly we're getting there. There is one problem now, which is that the ? and params are deleted if there were any on the url.. anything to do about it?
I'm using it like that:
<a href="#" onclick="tb_open_new('' +entry.url + '?TB_iframe=true&height=400&width=400')"
thanks.
#35 by Avi on February 28, 2009 - 4:44 am
Quote
I think I can better describe the problem. all links are getting ? in the end of them. For some it doesn't matter, and others will open a white page. (if I cut the ? it will open correctly.
#36 by Avi on February 28, 2009 - 4:47 am
Quote
http://feed252.photobucket.com/albums/hh12/mama_l…?
(for example.)
#37 by Dharmavirsinh Jhala on February 28, 2009 - 9:18 pm
Quote
I didn't get you by above URL as I can't see anything when I go to that URL.
#38 by Dharmavirsinh Jhala on February 28, 2009 - 9:50 pm
Quote
OK Avi,
I got it; Right now what quick and dirty solution I can suggest you is that don't put "?" before you put TB_iframe it means that your URL will look like following:
entry.url+"TB_iframe=blah…blah.."
instead of
entry.url+"?TB_iframe=blah…blah.."
I am sure this will help you in this case. Actually this is wrong with the URL it should not behave like this with just "?"; anyways it's their strategy; you have solution now.
#39 by Avi on March 1, 2009 - 8:19 am
Quote
Yes, you're right, it's nicely working, thanks!.
#40 by Gonzalo on April 7, 2009 - 9:22 am
Quote
Thanks a lot, now I'm using the tb_open_new function. It work great.
#41 by Stephen on April 28, 2009 - 1:27 am
Quote
Hey I was wondering if anyone knows how to launch the inline content with a js function call. This is the current link.
<a href="#tb_inline?height=155&width=300&inlineid=hiddenmodalcontent&modal=true">show hidden modal content.
But I would prefer to us js function to do this.
Thanks
#42 by Stephen on April 28, 2009 - 1:28 am
Quote
oops the link code is below
#tb_inline?height=155&width=300&inlineid=hiddenmodalcontent&modal=true class= hickbox
#43 by David on April 28, 2009 - 3:04 am
Quote
This looks to be exactly what I want but I am not sure how to use tb_remove_open. Can you give an example? (I keep getting "jThickboxNewLink is not a function").
Also is it possible to have the modal window content refresh with the content of a hidden div on the same page? For example in psuedo html
stuff in here with link <a>to show content of div id "two" in modal window
this should replace id "one" in thickbox modal window
Link <a>show content of id one in modal window.
What happens when I do it is the stuff in id "two" is appended to the content on id "one" in the modal window.
Any help would be very much appreciated.
#44 by Nick Poulos on May 15, 2009 - 1:18 am
Quote
David & Yen-Wei Liu,
I was having the same error as you both when trying to use tb_remove_open. Here is what I did to get it to work:
var jThickboxNewLink;
function tb_remove_open(reloadLink) {
jThickboxNewLink = reloadLink;
tb_remove();
setTimeout("tb_open_new(jThickboxNewLink);", 500);
return false;
}
Hope that helps.
#45 by Torrey on June 2, 2009 - 6:32 am
Quote
banktip and others:
Not sure if anybody still needs to know how to do this but I'm going to share anyway.
To close the thickbox window and reload/refresh the parent page you can do it two ways:
#1 – lets say you have a parent page that lists all your contacts. You have a link that opens a thickbox window to create new contacts. On this thickbox window you enter a new contact, click submit, form saves, and reloads thickbox window. If you want to enter another new contact you can in the same open thickbox window. You need a way to eventually exit the thinkbox window and reload/refresh the parent window so all the new contacts you've just added are shown. Do this -
#2 – Same as #1 except you only want to enter one new contact at a time and have the thickbox window close and reload/refresh the parent. If the user needs to add another new contact they would click on the link that opens the thickbox window. When you click the submit button on a form it reloads the page, being the thickbox window, after the vbscript that saves to the table the new contact you need to exit the thickbox window and refresh the parent. Do this – (yes, you can call javascript from vbscript code in this manner in all browsers)
<%
.. vbscript code that saves new record….
response.write "self.parent.tb_remove(); parent.location.reload(1)"
%>
Regards,
Torrey
#46 by Torrey on June 2, 2009 - 6:34 am
Quote
This is way #1 – not sure why it didn't post properly…
input name="button_Close" type="submit" id="button_Close" value="Close thickBox" onclick="self.parent.tb_remove(); parent.location.reload(1)"
Regards,
Torrey
#47 by Damien on June 6, 2009 - 1:47 am
Quote
The parent window call back function is really handy. Thanks.
Don't forget to escape any quotes that you want to pass back to the parent window(caught me out there)
#48 by Fady on June 29, 2009 - 12:34 am
Quote
Hi all ..
i'm new To jQuery-thickbox and i need Help .
i used thickbox to open an Asp.net page with more controls and it was good now i have to return selected value from thickbox to the parent page ….
How Can I do that .. plz help me ???
#49 by Dharmavirsinh Jhala on June 30, 2009 - 3:16 am
Quote
Hi Fady,
To return value to the parent page/form just use self.parent.
for example:
while you are closing your child page which is opened via thickbox you can call following code:
self.parent.passToParentPage(Param1, Param2, Param3);
and function passToParentPage should be defined on your parent page like following:
function passToParentPage(Param1, Param2, Param3)
{
// code which will store Params to hidden variable or do other required processing/computation
}
Let me know if this can't help you.
#50 by Dipanjan on July 8, 2009 - 9:16 pm
Quote
Sir,
I’ve used thickbox (modified) successfully in my website. You can browse the \Requests\ links and click on the \Read Posts\ link. An iframe based modal window will appear.
My problem is that the thickbox is taking too much time to get loaded. Is there any fixes for me? Thanx in advance.
#51 by Dharmavirsinh Jhala on July 9, 2009 - 2:58 pm
Quote
Hi Dipan,
Basically the delay which is created is just because of contents you are loading in the thickbox using URL itself is slow.
Thickbox won't show full page till all the contents are loaded, here I have observed that the way you are loading image is creating problem. Make thumbnail of uploaded image and you should see dramatic improvements in the load time of the thickbox window.
Let me know if it helps.
#52 by bobo on August 15, 2009 - 1:28 am
Quote
Thanks for your tips.
In some cases, you may want to remove ability to close lightbox with esc key. In this, case comment out line tb_remove() after "if(keycode == 27)" in two places. Also remove the link with ID of TB_closeWindowButton in 3 places to remove link in upper right corner.
Today I want to add an Ajax call to my database to get data to fill the thickbox. The tb_init() function seems to be best place to put this, but I can't figure out
what actually calls tb_init().
#53 by Fady on August 20, 2009 - 10:45 am
Quote
Dear : Dharmavirsinh Jhala
I use
Top.Window.Document.GetElemrntByID();
to catch the parent's Controls And it's Work
But i Admire your Way of solve , but i don't Test it Yet ..
But Thanks in Advance … Sorry $ being late
Good bye
#54 by Angeline on August 31, 2009 - 7:18 pm
Quote
Hi, Your code is really good.I was searching how to use thickbox without href link, because I add an Id variable to the link, on clicking the link. This code works fine except for one problem. the first time I click the link,nothing appears,the pages goes black.(Coz I haven't mentioned a href attribute in the anchor tag,only in the onclick function, I set the href attribute of the link). And only when I click the link for the second time, the required link comes up. Is there any way to solve this problem?
#55 by Angeline on August 31, 2009 - 9:24 pm
Quote
Hi , you had already given a solution in the previous comments which I didn't notice earlier. I added the line tb_open_new($(this).attr("href")); after changing the href link, and it works perfect now. The content is loaded in the first click itself.. Thanks a lot for your code..
#56 by Jayme on September 2, 2009 - 10:23 am
Quote
Using a slightly modified version of ThickBox. My client wants to be able to close the tbox from a link that will also redirect the user to a new page on his site.
1 – I can't even get the tbox to close from an inside link. I just reloads the content.
2 – Can it be made to refresh the parent page to a new URL?
Many thanks for your time.
J.
#57 by Angeline on September 2, 2009 - 3:03 pm
Quote
Hi, I tried your suggestion on adding the line tb_open_new($(this).attr("href")); when the urls are loaded dynamically in a javascript function. It works correctly, but when I click the same link for the second time without a page refresh, I get two thickbox windows,the top one has the content and the bottom one is empty. How to resolve this problem?
#58 by vivek on September 12, 2009 - 7:58 pm
Quote
Sir i am using thick box iframe it shows the close option in thickbox.js , but i want a link on my main page also to close the iframe.
#59 by Dharmavirsinh Jhala on September 13, 2009 - 6:58 pm
Quote
Hi Vivek,
If you are opening Thickbox main/parent window will not have focus and controls on parent window won't be clickable by users in that case putting up a Close link does not make sense to me on main/parent window.
If you want to put a close link on Child/Thickbox window then please use following code to close Thickbox from Thickbox model window itself.
onclick="javascript:self.parent.tb_remove();"
Let me know if you have any other question.
#60 by Ashish Taralekar on September 18, 2009 - 10:42 pm
Quote
Hi,
I am showing child window (contains an imagebutton, textboxes etc.) using thickbox and I am redirecting user to another page on click of that imagebutton using Response.Redirect. But, the problem is the page gets opened in the same thickbox. I want that page should open in the parent window.
So, please suggest me what should I do for this?
Thanks,
Ashish.
#61 by GLV on October 10, 2009 - 3:13 am
Quote
I'm getting an error ("missing ] after element list" ) with this code:
if(parent_func_callback != undefined)
eval("window."+parent_func_callback);
Couldn't figure out exactly what you were trying to do with this line so I commented it out and, lo and behold!, the thickbox still works as planned.
Could you shed some light on this, pls? Thanks!
#62 by GLV on October 10, 2009 - 3:16 am
Quote
For #11 Ashish Taralekar,
you could try using window.top.location.href = {your url}. That will make the parent window change locations instead of using server side code [Response.Redirect].
#63 by Britt on October 14, 2009 - 11:42 pm
Quote
I have two css running on one template thickbox and lightbox. I can't seem to get thickbox to work at all and I read your new code above but don't know where I should put it in the thickbox.css file.
#64 by charlie on December 11, 2009 - 1:58 am
Quote
thanks #13, that's exactly what i've been looking for.
#65 by amit bravo on December 24, 2009 - 8:54 pm
Quote
great work Dharma.. but actually we need a little more fix . the code Open Thickbox without href attribute
somtimes sucks if you webpage is long and link is in middle somewhere of the page when you click on the page though it opens thickbox but because of # .. this hash appears in the URL field of the browser and we are jumped in the begining of the page . sucks
if we try instead Open Thickbox without href attribute
then it works perfectly but there is also one thing that needs to be sorted out and that is what if a user disable java script of the browser . in this case i want my link like
Open Thickbox without href attribute
I think we can use function like preventDefault() somwhere is our function or any other trick and will stop to jump the page while javascript is enabled will help a lot
any trick ?
#66 by amit bravo on December 24, 2009 - 8:59 pm
Quote
I am sorry in the last comment the code i pasted converted in a link automatically .. please open view source to see the difference
or check this out >
a href="#" onclick="tb_open_new('window_one.html?TB_iframe=true&height=400&width=400&modal=true')
I used following to prevent hash problem that let us jump to begin of the web page which was looking ugly
a href="javascript: void(0);" onclick="tb_open_new('window_one.html?TB_iframe=true&height=400&width=400&modal=true')
but it would be great if somehow i could use a webpage link so that if javascript is disable yet link should work
a href="window_one.html" onclick="tb_open_new('window_one.html?TB_iframe=true&height=400&width=400&modal=true')
#67 by Dharmavirsinh Jhala on December 25, 2009 - 3:32 am
Quote
Hi Amit,
Thanks for helping me by looking at it with another direction.
Here is a simple solution to your problem.
Solution #1:
a href="http://www.digitss.com" onclick="return tb_open_new('www.digitss.com');"
In this case make sure to return false in "tb_open_new" function just like following:
function tb_open_new(jThickboxNewLink){
tb_show(null,jThickboxNewLink,null);
return false;
}
Solution #2:
a href="http://www.digitss.com" onclick="tb_open_new('www.digitss.com'); return false;"
And in that case no other change is required.
So All the Best.
Dharmavir.
#68 by amit bravo on December 25, 2009 - 2:51 pm
Quote
Thanks , Dharma ,its working
. though last night before your comment i tried this one and it works
$(document).ready(function(){
$("#Btn").click(function(event){
event.preventDefault();
tb_open_new('window_one.html?TB_iframe=true&height=400&width=400&modal=true');
});
});
where link was something like
#69 by senthilvelan on January 8, 2010 - 3:33 pm
Quote
Hi this is good work.
But i need one more thing just want to close the box once click \esc\ key or mouse click in overlay(Like in original thickbox),i think the problem is related to jquery function for this issue.
can you help me regarding this.
#70 by Pdfman on February 1, 2010 - 6:19 pm
Quote
that’s exactly what i’ve been looking for.
#71 by shap on March 4, 2010 - 12:03 pm
Quote
Hi,
Re#11 and #13. I can now close the thickbox from my button i have created, which is great…however, how can i now redirect the parent to a different url?
Cheers,
shap.
#72 by Thomas Fitzgerald on March 19, 2010 - 6:34 am
Quote
The ability to close a thickbox and automatically load another one is great. I am however having one issue. I am loading the thickbox using AJAX and not iFrame. The issue is that in the second page that gets loaded in a thickbox $(document).ready is not getting fired.
Any ideas?
Thanks for your help and the great thickbox extension.
Thomas
#73 by santhosh on June 20, 2010 - 6:28 pm
Quote
Hi can the call back function have arguments with it. I tried to send three arguments in the call back function to be called from the parent window but nothing happens. can u say whether the code u have writen handles arguments also or shud i modify the call back to accept arguments
#74 by Dharmavirsinh Jhala on June 26, 2010 - 3:40 pm
Quote
Hi Santosh,
The code does not handle arguments..
You need to modify the code to handle arguments.
Please update me once you do that.
Thanks.!
#75 by Doug on July 14, 2010 - 2:34 am
Quote
Another request for the ability to handle arguments or non-thickbox querystring parameters. That would really be useful.
#76 by Dharmavirsinh Jhala on July 14, 2010 - 5:06 am
Quote
Sure Doug,
Give me a time of 1 week. I will look into this request.
#77 by gusty guesty on August 23, 2010 - 7:35 pm
Quote
is there any way to close the modal window and have it automatically load a new (parent?) .html page?
thanks
#78 by gusty guesty on August 23, 2010 - 7:49 pm
Quote
eg. onclick="self.parent.tb_remove(); parent.location.reload('page2.html');"
#79 by gusty guesty on August 24, 2010 - 6:25 pm
Quote
FOUND IT!! if any one else needs to know how to load another page upon close window this works..
onclick="self.parent.tb_remove();self.parent.location='new_page.html'"
#80 by Dharmavirsinh Jhala on August 24, 2010 - 7:59 pm
Quote
#81 by michael on December 9, 2010 - 4:29 am
Quote
I want to use thickbox in a website with apache RewriteEngine On (mod_rewrite). Seems that thickbox failled showing white page. Has anyone solved this problem?
#82 by Dharmavirsinh Jhala on December 9, 2010 - 8:14 am
Quote
Michael,
I will be able to help you. Can you send me example code you're trying to get running?
It should be matter of providing correct url path to thickbox. Basically it should be able to open everything you type in to the browser address-bar. So if browser shows that URL correctly thicbox will and should.
You can send me a zip or upload sample as I mentioned earlier. I will help you get it running.
Regards,
Dharmavirsinh Jhala
#83 by prgmr on January 27, 2011 - 2:56 pm
Quote
its great really great
#84 by the guy on April 8, 2011 - 5:10 pm
Quote
i cant get the second thickbox to close without reloading or opening a new page, can you help plz?
#85 by Dharmavirsinh Jhala on April 9, 2011 - 11:50 am
Quote
Can you past your code you\’re using or upload sample file somewhere on ftp/web so that I can check?
#86 by Guest on September 28, 2011 - 8:37 pm
Quote
how to open a thick box window from a thickbox without closing the first thickbox window
#87 by Devra on October 26, 2011 - 6:20 pm
Quote
Is it possible to have hyperlink button within a modal window? When my modal .jpg pops up, I want the user to be able to click on a button within the jpg (or the entire jpg if necessary) to transfer to a website? Thanks in advance for you help.
#88 by Corporate SEO on December 23, 2011 - 4:30 am
Quote
Just stumbled across your post – I have a situation where Google has indexed a ton of modal windows being called in thickbox as other URLs within the site… which means a user can end up on a page in full view that is intended to be a modal window only. Hopefully I can further hack what you have so the user is directed back to the parent page with the modal window opening on load. Thanks a lot for your work here and for sharing! If I get that to work I will come back and share the solution.
Thanks!
Jim
#89 by Dharmavirsinh Jhala on January 15, 2012 - 6:18 pm
Quote
I think it's pretty easy with some code where you check function or some variable defined in parent document by checking this.parent.someVariable, if it is undefined it means it's being opened directly else from thickbox.
if(window.parent.blnParent == undefined)
{
// redirect to parent page with some flag which will open thickbox upon parent load
}
I hope this helps.
#90 by Etika on June 26, 2012 - 6:09 pm
Quote
I have used thickbox with Iframe on a InnerPage. The issue is that the overlay opens on the inner page.I want to open the overlay on the main page.Please guide me.
#91 by hardik on October 1, 2012 - 12:57 pm
Quote
how can i use DIV ID in tb_open_new() ?
#92 by Dharmavirsinh Jhala on January 12, 2013 - 5:31 pm
Quote
You can not, tb_open_new takes URL with options as a query string (#) into parameter.