How to style content in jQuery Facebox
- by musoNic80
I'm using jQuery Facebox plugin to create some modal windows. One situation is to display errors that might occur. If JS is disabled, I do this by displaying any errors in a normal div that is styled by CSS using a class selector. If the user does have JS enabled however, that div is hidden and the info is displayed in a facebox. The problem I have is that all the CSS styling is lost when the data is displayed within a facebox window.
I understand that you can attach extra classes if you're calling facebox from a rel attribute in an anchor tag, but I'm using it programatically. Is there a way I can bind something to the facebox method?
Here's my js code (the HTML should be self-explanatory):
$(document).ready(function() {
$(".errors").hide(); // hides the non-js error div
$.errors = $(".errors").html(); // get the html from the error div
if($.errors!==''){
$.facebox($.errors); // if there are any errors, display them in facebox
}
});