Commit d598d6db authored by Floréal Cabanettes's avatar Floréal Cabanettes

Add animation + scroll to top on notify + scroll to bottom on add subtr

parent f3b2b8bd
This diff is collapsed.
......@@ -111,6 +111,10 @@ form .newline button {
background: #bb842e;
}
#notify {
animation-duration: 0.3s;
}
div.transaction {
margin-top: 10px;
padding-bottom: 10px;
......
......@@ -7,6 +7,7 @@
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css"/>
<link rel="stylesheet" type="text/css" href="css/bootstrap-datepicker3.min.css"/>
<link rel="stylesheet" type="text/css" href="css/animate.min.css"/>
<link rel="stylesheet" type="text/css" href="css/trackmybank.css"/>
<script type="application/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="application/javascript" src="js/moment-with-locales.min.js"></script>
......
......@@ -65,6 +65,7 @@ trackmybank.login = function() {
trackmybank.add_transaction = function () {
$("#transactions").append(trackmybank.transaction_html.clone());
$("#del-subtr").show();
trackmybank.scroll_to_bottom();
};
trackmybank.del_transaction = function () {
......@@ -85,11 +86,27 @@ trackmybank.hide_notify = function() {
$("#notify").html("").attr("class", "").hide();
};
trackmybank.scroll_to_top = function(callback) {
$("html, body").animate({ scrollTop: 0 }, 200);
if (callback !== null) {
setTimeout(callback, 200);
}
};
trackmybank.scroll_to_bottom = function(callback) {
$("html, body").animate({ scrollTop: $(document).height() }, 200);
if (callback !== null) {
setTimeout(callback, 200);
}
};
trackmybank.notify = async function(level, message) {
$("#notify").html(message).attr("class", level).show();
trackmybank.timeout = setTimeout(function(){
$("#notify").html("").attr("class", "").hide();
}, 5000);
trackmybank.scroll_to_top(function() {
$("#notify").html(message).attr("class", level).addClass('animated zoomIn').show();
trackmybank.timeout = setTimeout(function(){
$("#notify").removeClass("animated zoomIn").addClass("animated fadeOutUp").hide().html("").attr("class", "");
}, 5000);
});
};
trackmybank.ajax = function (url, data, success, error, method = "POST", async = true) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment