need a way to change the wordpress media uploader div TB_window css

apologies for the question again my last question was poorly asked and code was missing.

I’m having trouble with my plugin I’m trying to implement the wordpress media uploader, unfortunately iv ran into a problem

Read More

i have it working and showing up when a upload button is clicked but it shows only half of the uploader

i think i found the problem for some reason the TB_window div opens with
margi-left: -334px;
i adjusted this in fire fox (fire bug) to auto it appears normally e.g. the current div looks like this.

<div id="TB_window" style="width: 670px; height: 351px; margin-left: -335px; top: 20px; margin-top: 0pt; display: block;">

and if i change it to

<div id="TB_window" style="width: 670px; height: 351px; margin-left auto; margin-right: auto; top: 20px; display: block; position: fixed;">

there must be a simple hook / way to change the css for this box for my plugin

how can i do this ?

Related posts

Leave a Reply

2 comments

  1. Well I think the easiest would be to just edit the CSS file for your WordPress installation. Log into WordPress and navigate to Appearance -> Editor. Then find styles.css in bottom right. Add your CSS markup to here.

    div#TB_window { margin-left: auto; }
    

    If that doesn’t work then you can insert code into the head of your blog using a callback.

    add_action('wp_head', 'InsertMyStyleSheet');
    
    function InsertMyStyleSheet() {
      echo '<link href="pathToStylesheet" type="text/css" rel="stylesheet" />
    }
    

    And add your own CSS for your theme there.

  2. As long as relying on Javascript isn’t a problem, you could try the following:

    _tbw = document.getElementById('TB_window');
    _tbw.style.margin = "auto";
    

    Or, if you’re using jQuery:

    $(document).ready(function(){ 
      var _TBwindow = $('#TB_window');
      _TBwindow.css('margin-left', 'auto');
    }