mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
|
@ -0,0 +1,77 @@
|
|||
(function() {
|
||||
var $;
|
||||
|
||||
$ = jQuery;
|
||||
|
||||
$.bootstrapGrowl = function(message, options) {
|
||||
var $alert, css, offsetAmount;
|
||||
options = $.extend({}, $.bootstrapGrowl.default_options, options);
|
||||
$alert = $("<div>");
|
||||
$alert.attr("class", "bootstrap-growl alert");
|
||||
if (options.type) {
|
||||
$alert.addClass("alert-" + options.type);
|
||||
}
|
||||
if (options.allow_dismiss) {
|
||||
$alert.addClass("alert-dismissible");
|
||||
$alert.append("<button class=\"close\" data-dismiss=\"alert\" type=\"button\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>");
|
||||
}
|
||||
$alert.append(message);
|
||||
if (options.top_offset) {
|
||||
options.offset = {
|
||||
from: "top",
|
||||
amount: options.top_offset
|
||||
};
|
||||
}
|
||||
offsetAmount = options.offset.amount;
|
||||
$(".bootstrap-growl").each(function() {
|
||||
return offsetAmount = Math.max(offsetAmount, parseInt($(this).css(options.offset.from)) + $(this).outerHeight() + options.stackup_spacing);
|
||||
});
|
||||
css = {
|
||||
"position": (options.ele === "body" ? "fixed" : "absolute"),
|
||||
"margin": 0,
|
||||
"z-index": "9999",
|
||||
"display": "none"
|
||||
};
|
||||
css[options.offset.from] = offsetAmount + "px";
|
||||
$alert.css(css);
|
||||
if (options.width !== "auto") {
|
||||
$alert.css("width", options.width + "px");
|
||||
}
|
||||
$(options.ele).append($alert);
|
||||
switch (options.align) {
|
||||
case "center":
|
||||
$alert.css({
|
||||
"left": "50%",
|
||||
"margin-left": "-" + ($alert.outerWidth() / 2) + "px"
|
||||
});
|
||||
break;
|
||||
case "left":
|
||||
$alert.css("left", "20px");
|
||||
break;
|
||||
default:
|
||||
$alert.css("right", "20px");
|
||||
}
|
||||
$alert.fadeIn();
|
||||
if (options.delay > 0) {
|
||||
$alert.delay(options.delay).fadeOut(function() {
|
||||
return $(this).alert("close");
|
||||
});
|
||||
}
|
||||
return $alert;
|
||||
};
|
||||
|
||||
$.bootstrapGrowl.default_options = {
|
||||
ele: "body",
|
||||
type: "info",
|
||||
offset: {
|
||||
from: "top",
|
||||
amount: 20
|
||||
},
|
||||
align: "right",
|
||||
width: 250,
|
||||
delay: 4000,
|
||||
allow_dismiss: true,
|
||||
stackup_spacing: 10
|
||||
};
|
||||
|
||||
}).call(this);
|
Loading…
Add table
Add a link
Reference in a new issue