How can I see if the current page is loaded in a ThickBox?
I'm using ThickBox for a ligh开发者_如何学运维tbox and I need to check if the current page exists within a TB or not. How can I do this with jQuery?
Presumably your boxed page could check for a container. On the demo site, the container has the id TB_window
. So in that example, you could do something like this:
if( $('selector-for-stuff-that-might-be-boxed').closest('#TB_window').size() ){
// you're probably in a box
}
Note: if the point of this is to apply different styles to the boxed content, you can do that with just regular CSS by adding that ID to the CSS selector:
/* applies to non-boxed content */
.my-style { /*...*/ }
/* applies to boxed content */
#TB_window .my-style { /*...*/ }
精彩评论