JSFiddle - React, Tailwind, and code Playground
by mackry
HTML
<div id="overlay"></div>
<div id="border">
<div id="dialog">
<form id="question-details">
<button id="cancel">Cancel</button>
<textarea rows="2" cols="20" id="question-details"></textarea>
</form>
</div>
</div>
<form>
<input type="text" class="question" id="question" />
<button id="ask">Ask Question</button>
</form>
CSS
body {
background: #F7FAFC;
}
form {
position: absolute;
left: 200px;
top: 100px;
}
input.question {
outline: none;
width: 250px;
padding: 6px;
border: 1px solid #b0bcc1;
-moz-box-shadow: inset 0px 2px 3px #f5f5f5;
-webkit-box-shadow: inset 0px 2px 3px #f5f5f5;
box-shadow: inset 0px 2px 3px #f5f5f5;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
#border {
background: rgba(30,70,90,0.7);
height:0;
width: 0;
opacity: 0;
position: absolute;
left: 0;
top: 0;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
-moz-box-shadow: 0 2px 4px rgba(0,0,0,0.3);
-webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.3);
box-shadow: 0 2px 3px rgba(0,0,0,0.3);
}
#border {
display: none;
height: 0;
width: 400px;
left: 185px;
top: 100px;
opacity: 1;
padding: 6px;
}
#dialog {
height: 100%;
width: 100%;
background: #FFF;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
-moz-box-shadow: 0 1px 1px #316378;
-webkit-box-shadow: 0 1px 1px #316378;
box-shadow: 0 1px 1px #316378;
}
button#cancel {
display: none;
margin-top: 9px;
color: #626262;
text-shadow: 0 1px #f2f2f2;
border: 1px solid #c2c2c2;
background: -webkit-gradient(linear, left top, left bottom, from(#ececec), to(#d2d2d2));
background: -moz-linear-gradient(top, #ececec, #d2d2d2);
-moz-box-shadow: inset 0 1px #fff, 0 1px 2px #b6c4ca;
-webkit-box-shadow: inset 0 1px #fff, 0 1px 2px #b6c4ca;
box-shadow: inset 0 1px #fff, 0 1px 2px #b6c4ca;
}
button#cancel:active {
background: -webkit-gradient(linear, left top, left bottom, from(#d2d2d2), to(#ececec));
background: -moz-linear-gradient(top, #d2d2d2, #ececec);
}
JavaScript
$(document).ready(function() {
var overlay = $('#overlay'),
dialog = $('#border'),
cancel = $('#cancel');
$('#question').focus(function() {
openDialog();
}).blur(function() {
closeDialog();
});
cancel.click(closeDialog);
function openDialog() {
dialog.show().animate({
top: 70,
height: 250
}, 100);
}
function closeDialog() {
dialog.fadeOut(50, function() {
dialog.css({
top: 100,
height: 0
});
});
}
});