开发者

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

开发者 https://www.devze.com 2023-04-09 04:53 出处:网络
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

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

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 chan开发者_Python百科ge the css for this box for my plugin

how can i do this ?


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号