Radek
Radek

Reputation: 11091

how to do css div pop up scrollable using only javascript?

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.

Upvotes: 1

Views: 6573

Answers (1)

Mark Coleman
Mark Coleman

Reputation: 40863

you should be able to accomplish 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;
}

Upvotes: 7

Related Questions