updated demo

This commit is contained in:
Federico Zivolo 2014-09-26 13:29:07 +02:00
parent 8671429577
commit db3e1e9fcb
4 changed files with 578 additions and 477 deletions

View File

@ -509,7 +509,7 @@
<h1 id="icons">Icons</h1>
<p>Material Design for Bootstrap includes 490 original Material Design icons!<br>
These icons are extracted from the original Google sources and are licensed under BSD license.<br>
Them are provided as an iconic font easy to use.
They are provided as an iconic font for easy use.
</p>
<p>Variations are available for every icon, included for the original Bootstrap icons.<br>
<br>Example:<br><br>
@ -1879,6 +1879,7 @@
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h2>Panels</h2>

File diff suppressed because it is too large Load Diff

View File

@ -4,41 +4,55 @@ $(function (){
ripples.init(".btn:not(.btn-link), .navbar a, .nav-tabs a, .withripple");
// Add fake-checkbox to material checkboxes
$(".checkbox > label > input").after("<span class=check></span>");
var initInputs = function() {
// Add fake-checkbox to material checkboxes
$(".checkbox > label > input").not(".bs-material").addClass("bs-material").after("<span class=check></span>");
// Add fake-radio to material radios
$(".radio > label > input").after("<span class=ripple></span><span class=circle></span><span class=check></span>");
// Add fake-radio to material radios
$(".radio > label > input").not(".bs-material").addClass("bs-material").after("<span class=circle></span><span class=check></span>");
// Add elements for material inputs
$("input.form-control, textarea.form-control, select.form-control").each( function() {
$(this).wrap("<div class=form-control-wrapper></div>");
$(this).after("<span class=material-input></span>");
if ($(this).hasClass("floating-label")) {
var placeholder = $(this).attr("placeholder");
$(this).attr("placeholder", null).removeClass("floating-label");
$(this).after("<div class=floating-label>" + placeholder + "</div>");
}
if ($(this).val() === "") {
$(this).addClass("empty");
}
// Add elements for material inputs
$("input.form-control, textarea.form-control, select.form-control").not(".bs-material").each( function() {
if ($(this).is(".bs-material")) { return; }
$(this).wrap("<div class=form-control-wrapper></div>");
$(this).after("<span class=material-input></span>");
if ($(this).hasClass("floating-label")) {
var placeholder = $(this).attr("placeholder");
$(this).attr("placeholder", null).removeClass("floating-label");
$(this).after("<div class=floating-label>" + placeholder + "</div>");
}
if ($(this).is(":empty") || $(this).val() === null || $(this).val() == "undefined" || $(this).val() === "") {
$(this).addClass("empty");
}
if ($(this).parent().next().is("[type=file]")) {
$(this).parent().addClass("fileinput");
var $input = $(this).parent().next().detach();
$(this).after($input);
}
});
if ($(this).parent().next().is("[type=file]")) {
$(this).parent().addClass("fileinput");
var $input = $(this).parent().next().detach();
$(this).after($input);
}
});
};
initInputs();
// Support for "arrive.js" to dynamically detect creation of elements
// include it before this script to take advantage of this feature
// https://github.com/uzairfarooq/arrive/
if (document.arrive) {
document.arrive("input, textarea, select", function() {
initInputs();
});
}
$(document).on("keyup change", ".form-control", function() {
if ($(this).val() !== "") {
$(this).removeClass("empty");
} else {
$(this).addClass("empty");
}
});
$(document).on("keydown change", ".form-control", function() {
$(this).removeClass("empty");
var self = $(this);
setTimeout(function() {
if (self.val() === "") {
self.addClass("empty");
} else {
self.removeClass("empty");
}
}, 1);
});
$(document)
.on("focus", ".form-control-wrapper.fileinput", function() {

View File

@ -57,7 +57,7 @@ var ripples = {
$ripple.setAttribute("style", $ripple.getAttribute("style") + ["-ms-" + scale,"-moz-" + scale,"-webkit-" + scale,scale].join(";"));
// Dirty fix for Firefox... seems like absolute elements inside <A> tags do not trigger the "click" event
if (/firefox/i.test(navigator.userAgent)) {
if (/firefox|crios|safari|ip(ad|hone|od)/i.test(navigator.userAgent)) {
$el.click();
}