Iniit
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
.floating-label-form-group {
|
||||
/*border-bottom: 1px solid #ccc;*/
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
/*padding-bottom: 0.5em;*/
|
||||
}
|
||||
|
||||
.floating-label-form-group input,
|
||||
.floating-label-form-group textarea {
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
box-shadow: none !important;
|
||||
position: relative;
|
||||
/*font-size: 1.1em;*/
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.floating-label-form-group select {
|
||||
margin-top: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
margin-left: -4px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.floating-label-form-group label {
|
||||
display: block;
|
||||
position: relative;
|
||||
top: 2em;
|
||||
opacity: 0;
|
||||
z-index: 0;
|
||||
/*font-size: 0.85em;*/
|
||||
line-height: 1.764705882em;
|
||||
vertical-align: middle;
|
||||
vertical-align: baseline;
|
||||
margin: 0;
|
||||
-webkit-transition: top 0.5s ease, opacity 0.5s ease;
|
||||
-moz-transition: top 0.5s ease, opacity 0.5s ease;
|
||||
-ms-transition: top 0.5s ease, opacity 0.5s ease;
|
||||
transition: top 0.5s ease, opacity 0.5s ease;
|
||||
}
|
||||
|
||||
.floating-label-form-group:not(:first-child) {
|
||||
border-left: 1px solid #ccc;
|
||||
padding-left: 14px;
|
||||
}
|
||||
|
||||
.floating-label-form-group-with-value label {
|
||||
top: 0;
|
||||
opacity: .5;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.select2-choices {
|
||||
border: 0px !important;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
|
||||
.floating-label-form-group-with-focus label {
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
form .row:first-child .floating-label-form-group {
|
||||
/*border-top: 1px solid #ccc;*/
|
||||
}
|
||||
|
||||
.form-group-required {
|
||||
border-bottom: 1px solid #fb6b5b !important;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
$(function () {
|
||||
$("body").on("input propertychange", ".floating-label-form-group", function (e) {
|
||||
//$(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val());
|
||||
}).on("focus", ".floating-label-form-group", function () {
|
||||
//$(this).addClass("floating-label-form-group-with-focus");
|
||||
$(this).addClass("floating-label-form-group-with-value");
|
||||
}).on("blur", ".floating-label-form-group", function () {
|
||||
//$(this).removeClass("floating-label-form-group-with-focus");
|
||||
//$(this).removeClass("floating-label-form-group-with-value");
|
||||
//if ($('.floating-label-control').val().length == 0) {
|
||||
// $(this).removeClass("floating-label-form-group-with-value");
|
||||
//}
|
||||
if ($(this).find('.floating-label-control').val() != "") {
|
||||
$(this).addClass("floating-label-form-group-with-value");
|
||||
}
|
||||
else if ($(this).find('.floating-label-control').val() == "") {
|
||||
$(this).removeClass("floating-label-form-group-with-value");
|
||||
}
|
||||
}).on("focusin", ".floating-label-control", function () {
|
||||
$(this).attr('placeholder', $(this).data('placeholder'));
|
||||
}).on("focusout", ".floating-label-control", function () {
|
||||
$(this).attr('placeholder', $(this).data('label'));
|
||||
});
|
||||
});
|
||||
var _floatingLabelHelper = {
|
||||
init: function () {
|
||||
$('div.floating-label-form-group > input,textarea,select').each(function () {
|
||||
if ($(this).val() && !$(this).parent(".floating-label-form-group").hasClass("floating-label-form-group-with-value")) {
|
||||
$(this).parent(".floating-label-form-group").addClass("floating-label-form-group-with-value");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user