Paul,
 
Short answer -- yes, modify the code ;-)
To prevent closing by clicking on the overlay and remove the 'close' link (better IMHO than just disabling it), remove line 38:
   $("#TB_overlay").click(TB_remove);
 
remove the TB_closeWindow <div> from line 133:
   $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + imageCount + prev.html + next.html + "</div></div>");
 
remove line 135:
   $("#TB_closeWindowButton").click(TB_remove);
 
remove the TB_closeAjaxWindow <div> from line 205:
   $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div></div><iframe frameborder='0' hspace='0' src='' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
 
and 207:
   $("#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>");
 
remove line 210:
   $("#TB_closeWindowButton").click(TB_remove);
and remove lines 258-259:
   $("#TB_overlay").unbind("click");
   $("#TB_closeWindowButton").unbind("click");
 
 
Thickbox also has a keydown handler so that if you push 'escape' it closes. Remove lines 236-245 to prevent this:
   document.  
      if (e == null) { // ie
         keycode = event.keyCode;
      } else { // mozilla
         keycode = e.which;
      }
      if(keycode == 27){ // close
         TB_remove();
      } 
   }
 
 
To add the 'close' functionality to something, do this:
   $("#myTbCloseButton").click(TB_remove);
 
 
I've heavily customised TB to my own purposes over the last few days, hence a slight familiarity with the code :-D
Hope that helps,
rob
 
 
>
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.
 
Thanks,
 
Paul
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
<
----------------------- Original Message -----------------------
  
From: "Paul" <[EMAIL PROTECTED]>
To: "'jQuery Discussion.'" <discuss@jquery.com>
Date: Thu, 15 Mar 2007 08:37:21 -0700
Subject: [jQuery] changing default thickbox behavior
  

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.

 

Thanks,

 

Paul


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to