[jQuery] changing default thickbox behavior

[jQuery] changing default thickbox behavior

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40"
xmlns:o = "urn:schemas-microsoft-com:office:office"
xmlns:w = "urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=us-ascii">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR>
<STYLE>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue leftMargin=1
topMargin=1 rightMargin=1><FONT face=Tahoma
size=2>
<DIV>Paul,</DIV>
<DIV> </DIV>
<DIV>Short answer -- yes, modify the code
;-)</DIV>
<DIV>To prevent closing by clicking on the
overlay and remove the 'close' link (better
IMHO than just disabling it), remove line
38:</DIV>
<DIV>   $("#TB_overlay").click(TB_remove);</DIV>
<DIV> </DIV>
<DIV>remove the TB_closeWindow <div>
from line 133:</DIV>
<DIV>   $("#TB_window").append("<a
href='' id='TB_ImageOff' title='Close'><img
id='TB_Image' src='"+url+"' width='"+imageWidth+"'
height='"+imageHeight+"' alt='"+caption+"'/></a>"
+ "<div id='TB_caption'>"+caption+"<div
id='TB_secondLine'>" + imageCount + prev.html
+ next.html + "</div></div>");</DIV>
<DIV> </DIV>
<DIV>remove line 135:</DIV>
<DIV>   $("#TB_closeWindowButton").click(TB_remove);</DIV>
<DIV> </DIV>
<DIV>remove the TB_closeAjaxWindow <div>
from line 205:</DIV>
<DIV>   $("#TB_window").append("<div
id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div></div><iframe
frameborder='0' hspace='0' src='"+urlNoQuery[0]+"'
id='TB_iframeContent' name='TB_iframeContent'
style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH
+ 17)+"px;' onload='TB_showIframe()'>
</iframe>");</DIV>
<DIV> </DIV>
<DIV>and 207:</DIV>
<DIV>   $("#TB_window").append("<div
id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div></div><div
id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");</DIV>
<DIV> </DIV>
<DIV>remove line 210:</DIV>
<DIV>   $("#TB_closeWindowButton").click(TB_remove);</DIV>
<DIV>and remove lines 258-259:</DIV>
<DIV>   $("#TB_overlay").unbind("click");</DIV>
<DIV>   $("#TB_closeWindowButton").unbind("click");</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thickbox also has a keydown handler
so that if you push 'escape' it closes. Remove
lines 236-245 to prevent this:</DIV>
<DIV>   document.onkeyup = function(e){
 <BR>     
if (e == null) { // ie<BR>        
keycode = event.keyCode;<BR>     
} else { // mozilla<BR>        
keycode = e.which;<BR>     
}<BR>      if(keycode
== 27){ // close<BR>        
TB_remove();<BR>     
} <BR>   }</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>To add the 'close' functionality to
something, do this:</DIV>
<DIV>   $("#myTbCloseButton").click(TB_remove);</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>I've heavily customised TB to my own
purposes over the last few days, hence a
slight familiarity with the code :-D</DIV>
<DIV>Hope that helps,</DIV>
<DIV>rob</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT color=blue>> <BR>Is there a
way to modify the default Thickbox behavior?
 I don’t want the user to be able
to dismiss the TB window by clicking the
overlay or a close link—I want to programmatically
close it based on user input within the TB
window. <BR> <BR>Thanks, <BR> <BR>Paul
<BR>______________________________________________________________________<BR>This
email has been scanned by the MessageLabs
Email Security System.<BR>For more information
please visit <A href="http://www.messagelabs.com/email"><FONT
color=#0000ff>http://www.messagelabs.com/email</FONT></A>
<BR>______________________________________________________________________<BR><<BR></FONT></DIV></FONT>
<DIV style="FONT-SIZE: x-small; FONT-FAMILY:
Tahoma">
<DIV>----------------------- <B>Original
Message</B> -----------------------</DIV>
<DIV>  </DIV>
<DIV><B>From:</B> "Paul" <A href="mailto:montare@gmail.com"><FONT
color=#0000ff><montare@gmail.com></FONT></A></DIV>
<DIV><B>To:</B> "'jQuery Discussion.'"
<A href="mailto:discuss@jquery.com"><FONT
color=#0000ff><discuss@jquery.com></FONT></A></DIV>
<DIV><B>Date:</B> Thu, 15 Mar 2007 08:37:21
-0700</DIV>
<DIV><B>Subject: <U>[jQuery] changing
default thickbox behavior</U></B></DIV>
<DIV>  </DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Is
there a way to modify the default Thickbox
behavior?  I don’t want the user
to be able to dismiss the TB window by clicking
the overlay or a close link—I want
to programmatically close it based on user
input within the TB window.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Paul<o:p></o:p></SPAN></FONT></P></DIV><BR>______________________________________________________________________<BR>This
email has been scanned by the MessageLabs
Email Security System.<BR>For more information
please visit http://www.messagelabs.com/email
<BR>______________________________________________________________________<BR>
<STYLE type=text/css> P, UL, OL, DL, DIR,
MENU, PRE { margin: 0 auto;}</STYLE>
<FONT face=Tahoma size=2>
<DIV>_______________________________________________<BR>jQuery
mailing list<BR>discuss@jquery.com<BR>http://jquery.com/discuss/<BR><BR><BR></DIV></FONT>
<BR>
______________________________________________________________________<BR>
This email has been scanned by the MessageLabs Email Security System.<BR>
For more information please visit http://www.messagelabs.com/email <BR>
______________________________________________________________________<BR>
</BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/