开发者

force browser to add horizontal scroll bar?

开发者 https://www.devze.com 2023-01-05 08:22 出处:网络
Just wondering if there\'s some way to force the browser to bring up the horizontal scroll bar. My 开发者_如何学Pythonproblem is that I have some images in a div and they \"overflow\" out of it when I

Just wondering if there's some way to force the browser to bring up the horizontal scroll bar. My 开发者_如何学Pythonproblem 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


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.


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.

0

精彩评论

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

关注公众号