views:

105

answers:

2

Hey,

Just wondering if there's some way to force the browser to bring up the horizontal scroll bar. My problem is that I have some images in a div and they "overflow" out of it when I make the window smaller. I would rather not use the overflow property nor do I want to resize the images.

Thanks in advance,

Matt

A: 

Use the CSS3 overflow-x property to force scroll:

overflow-x: scroll

Tie that into a Javascript onresize callback and you should be all set.

hundredwatt
I would like a scrollbar for the entire page, not the div itself.
Matt
Have you tried using `overflow` directly on the body tag (maybe in combination with some `width` settings/adjustments)
hundredwatt
+1  A: 

Ahh, I'm such a noob. All I needed to do was add this to my scripts:

$(window).resize(function() {
if($(window).width() <= 1200)
    $("body").css("width","1200px");
else
$("body").css("width","100%");
});

This does exactly what I wanted it to do.

Thanks for your help guys.

Matt