I am in need of customizing the alert box using CSS attributes. Currently, I am able to achieve a similar effect with the code below:
JQUERY:
$('<div class="alertMessage">Error first</div>')
.insertAfter($('#componentName'))
.fadeIn('fast')
.animate({opacity: 1.0}, 2200)
.fadeOut('fast', function() {
$(this).remove();
});
CSS:
.alertMessage {
width: 95%;
margin: 1em 0;
padding: .5em;
background-image: -ms-radial-gradient(left top, circle farthest-corner, #F07E1A 0%, #F58CCB 100%);
background-image: -moz-radial-gradient(left top, circle farthest-corner, #F07E1A 0%, #F58CCB 100%);
background-image: -o-radial-gradient(left top, circle farthest-corner, #F07E1A 0%, #F58CCB 100%);
background-image: -webkit-gradient(radial, left top, 0, left top, 1012, color-stop(0, #F07E1A), color-stop(1, #F58CCB));
background-image: -webkit-radial-gradient(left top, circle farthest-corner, #F07E1A 0%, #F58CCB 100%);
background-image: radial-gradient(circle farthest-corner at left top, #F07E1A 0%, #F58CCB 100%);
text-align: center;
border: 3px solid white;
color: white;
font-weight: bold;
border-radius:4px;
display: none;
}
The above code will fade in and out after a few seconds. The animation will happen next to the component designated with
insertAfter($('#componentName'))
My requirements are as follows:
- The alert message should be positioned in the center of the window, similar to a normal alert box.
- The alert message should include an Okay button, resembling a standard alert box.
To achieve this, would simply adding an Okay button to the div and attaching a behavior suffice? Or is there a way to extend the default alert box functionality and apply the customized CSS properties mentioned above? If so, how can I accomplish this?