开发者

Vertical scrollbars with window.open

开发者 https://www.devze.com 2023-01-01 17:53 出处:网络
I am opening a popop windows with window.open. I want the scrollbars to show up if needed. However in safari, the scrollbars are not showing up unless I set, scrollbars=1,

I am opening a popop windows with window.open. I want the scrollbars to show up if needed. However in safari, the scrollbars are not showing up unless I set, scrollbars=1,

However that makes even horizontal scrollbars show up. Is there a way to specify,

"Show only horizontal scrollbars, if needed" to popop window.

开发者_如何学编程

(Possibly via some combinations of options to window.open, and overflow, css property.)


I've been messing with this a little and I settled on this solution until I find a better one:

window.open('http://yoursite.com','mypopup',
  'status=1,width=500,height=500,scrollbars=1');

Then in the CSS of yoursite.com, put this:

html {
  overflow-x: hidden;
  overflow-y: auto;
}

In some browsers, a vertical scrollbar may show even if the content fits in the window. But the horizontal scroll bar should not show.


After searching a lot I found this suitable

window.open("http://www.classi5.blogspot.com", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=400,height=400" 
0

精彩评论

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