lemdon
lemdon

Reputation: 171

jQuery css width not working in IE/Opera/FF but does in Chrome

So I'm working on a Wordpress theme at the moment but I'm having issues getting the blog to style properly.

I'm using some basic jQuery to get the width of the div with the content and then have that set the width of the wrapper called '.main'.

var blogWidth = $("#blogImages").width();
var blogTotal = blogWidth;
var totalCanvas = blogTotal;    
$('.main').css('width',totalCanvas);

It detects the proper width in Chrome but nothing else: http://leighmcd.com/blog/blog

The other issue was that I need the images to sit to the right of the content, even though they are in the same post so I put a div around the images and absolute positioned it. I have a feeling this may also be affecting the structure.

Any advice would be greatly appreciated.

Upvotes: 1

Views: 1243

Answers (2)

Blazemonger
Blazemonger

Reputation: 93003

Try adding units to your .css() call:

$('.main').css('width',totalCanvas+'px');

Upvotes: 0

Adriano Carneiro
Adriano Carneiro

Reputation: 58665

Use width to set the matched element's width:

$('.main').width(totalCanvas);

Upvotes: 2

Related Questions