How to style content in jQuery Facebox

Posted by musoNic80 on Stack Overflow See other posts from Stack Overflow or by musoNic80
Published on 2010-04-21T16:50:28Z Indexed on 2010/04/21 16:53 UTC
Read the original article Hit count: 417

Filed under:
|
|

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
    }
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about facebox