jQuery dialog UI sample
dialog UI sample
by simpleorchid
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<div id="banner-message">
<p>Hello World</p>
<button>Change color</button>
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information.</p>
</div>
<div id="data-tp" title="data-tp">
<p>This is ^ the default dialog which is useful for displaying information.</p>
</div>
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#banner-message {
background: #fff;
border-radius: 4px;
padding: 20px;
font-size: 25px;
text-align: center;
transition: all 0.2s;
margin: 0 auto;
width: 300px;
}
button {
background: #0084ff;
border: none;
border-radius: 5px;
padding: 8px 14px;
font-size: 15px;
color: #fff;
}
#banner-message.alt {
background: #0084ff;
color: #fff;
margin-top: 40px;
width: 200px;
}
#banner-message.alt button {
background: #fff;
color: #000;
}
JavaScript
// find elements
var banner = $("#banner-message")
var button = $("button")
var dlgs = $("#dialog").dialog({
/* dialogClass: "profile-details", */
autoOpen: false,
position: {
my: "left top",
at: "right bottom",
of: event,
offset: "20 20"
} });
// handle click and add class
button.on("click", function(){
//banner.addClass("alt")
$( "#dialog" ).dialog(
);
})
button.mouseover(function(){
dlgs.dialog("open");
}).mouseout(function(){
dlgs.dialog("close");
});
dlgs.html('Some text');