<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#login-modal"
style="z-index: 9999; position: fixed; right: 0; bottom: 0; border-radius: 0px;">Comments
</button>
<div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="feedbackmodal-container">
<h1 id="feedbackFormTitle">Post Comments</h1><br>
<div style="margin-left: 130px;">
<div class="ajaxLoader" style="display: none;"></div>
</div>
<form id="feedbackForm" action="/action">
<input type="text" id="emailAddress" name="email_address" placeholder="Your email address" disabled="">
<select id="type" name="type" class="form-control feedbackTypeDropdown">
<option>Select comment Type</option>
<option value="general">General</option>
</select>
<textarea id="description" class="form-control feedbackDescription" name="description"
placeholder="Tell us something more"></textarea>
<input type="submit" name="login" class="login feedbackmodal-submit" id="FeedbackSubmitBtn"
value="Submit Comments">
</form>
<div class="feedback-help">
Feedback text
</div>
</div>
</div>
</div>
/** Feedback modal */
.feedbackmodal-container {
padding: 30px;
max-width: 350px;
width: 100% !important;
background-color: #FFFFFF;
margin: 0 auto;
border-radius: 2px;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
overflow: hidden;
font-family: roboto;
}
.feedbackmodal-container h1 {
text-align: center;
font-size: 1.8em;
font-family: roboto;
}
.feedbackmodal-container input[type=submit] {
width: 100%;
display: block;
margin-bottom: 10px;
position: relative;
}
.feedbackmodal-container input[type=text], input[type=password] {
height: 44px;
font-size: 16px;
width: 100%;
margin-bottom: 10px;
-webkit-appearance: none;
background: #fff;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
/* border-radius: 2px; */
padding: 0 8px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.feedbackmodal-container input[type=text]:hover, input[type=password]:hover {
border: 1px solid #b9b9b9;
border-top: 1px solid #a0a0a0;
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
.feedbackmodal {
text-align: center;
font-size: 14px;
font-family: 'Arial', sans-serif;
font-weight: 700;
height: 36px;
padding: 0 8px;
/* border-radius: 3px; */
/* -webkit-user-select: none;
user-select: none; */
}
.feedbackmodal-submit {
/* border: 1px solid #3079ed; */
border: 0px;
color: #fff;
text-shadow: 0 1px rgba(0, 0, 0, 0.1);
background-color: #114c69;
padding: 17px 0px;
font-family: roboto;
font-size: 14px;
}
.feedbackmodal-submit:hover {
border: 0px;
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
background-color: #114c69;
}
.feedbackmodal-container a {
text-decoration: none;
color: #004a6f;
font-weight: bold;
text-align: justify;
display: inline-block;
opacity: 0.6;
transition: opacity ease 0.5s;
}
.feedbackmodal-container .feedbackTypeDropdown {
height: 44px;
padding: 0 5px;
border-radius: 0px;
margin-bottom: 10px;
}
.feedbackmodal-container .feedbackTypeDropdown:focus {
outline: 0;
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #ccc;
}
.feedbackmodal-container .feedbackDescription {
border-radius: 0px;
min-height: 150px;
margin-bottom: 10px;
resize: vertical;
}
.feedbackmodal-container .feedbackDescription:focus {
outline: 0;
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #ccc;
}
.feedback-help {
font-size: 12px;
}
/** Button ajax loader */
.ajaxLoader {
border: 5px solid #f3f3f3;
border-top: 5px solid #0c69a7;
border-radius: 50%;
width: 30px;
height: 30px;
animation: ajaxLoaderSpin 1s linear infinite;
}
@keyframes ajaxLoaderSpin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/** End of Feedback modal */
/* attach a submit handler to the form */
$("#feedbackForm").submit(function (event) {
$("#feedbackFormTitle").html("Sending your feedback ...")
$("#feedbackForm").hide();
$(".feedback-help").hide();
$('.ajaxLoader').show();
/* stop form from submitting normally */
event.preventDefault();
/* get the action attribute from the <form action=""> element */
var $form = $(this),
url = $form.attr('action');
/* Send the data using post with element id name and name2*/
var posting = $.post(url, {
email_address: $('#emailAddress').val(),
type: $('#type').val(),
description: $('#description').val()
});
/* Alerts the results */
posting.done(function (data) {
if (data.success === true) {
$('.ajaxLoader').hide();
$('#feedbackFormTitle').html(data.message);
console.log(data.message);
} else {
$("#feedbackFormTitle").html("Failed! Try again");
$("#feedbackForm").show();
$(".ajaxLoader").hide();
$(".feedback-help").show();
}
});
});