最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

scroll - how to do css div pop up scrollable using only javascript? - Stack Overflow

programmeradmin1浏览0评论

I want to display some text in a inline popup window with ok/close button.

I implemented and bit modified Custom Alert but sometimes the text has too many lines so I need the window scrollable.

I want to use only javascript. No framework nor libraries.

I want to display some text in a inline popup window with ok/close button.

I implemented and bit modified Custom Alert but sometimes the text has too many lines so I need the window scrollable.

I want to use only javascript. No framework nor libraries.

Share Improve this question asked Mar 2, 2011 at 23:00 RadekRadek 11.1k56 gold badges169 silver badges270 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

you should be able to acplish that with css

With the default style it would be like this:

#alertBox p {
    font:0.7em verdana,arial;
    height:50px;
    padding-left:5px;
    margin-left:55px;
    overflow:auto;
}

Example on jsfiddle.

Also as Casablanca points out, if you want to assign a specific class you can modify the javascript to use

msg.className = 'messageBox';

and then your own css

.messageBox{
  overflow:auto;
}
发布评论

评论列表(0)

  1. 暂无评论