Some more bugfixes, soft animation when resizing window

No more oh! (Hopefully)
This commit is contained in:
BNoiZe
2013-10-27 11:52:53 +01:00
parent c233fbfffb
commit fc69afcffc
5 changed files with 83 additions and 34 deletions

View File

@@ -363,6 +363,9 @@ aside.right {
right:36px;
font-size:80%;
}
.overviewsearch input[type="text"] {
width: 150px;
}
.overviewadd {
padding:10px;
@@ -834,6 +837,7 @@ select[multiple="multiple"] {
-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);
-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);
box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);
text-align: center;
}
.progress .bar {
width:1px;
@@ -908,12 +912,16 @@ label.nobr {
/* CANVAS STUFF */
.canvasitems {
margin: 0 auto;
text-align: center;
position:relative;
overflow:hidden;
width:100%;
margin-top:10px;
margin-bottom:10px;
padding: 0 0 0 10px;
}
.canvasbox {
width: 130px !important;
margin: 10px;
width: 130px;
margin: 10px 20px 10px 0;
text-align: center;
float: left;
height: 150px;

View File

@@ -1,4 +1,44 @@
(function($,sr){
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
func.apply(obj, args);
timeout = null;
};
if (timeout)
clearTimeout(timeout);
else if (execAsap)
func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100);
};
}
// smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery,'smartresize');
$(window).smartresize(function(){
resizecanvas();
});
function resizecanvas() {
var divwidth = $('#statsbox').width();
var space = divwidth % 150;
var elementspl = (divwidth - space) / 150;
var elementwidth = 130 + Math.round(space / elementspl) - 1;
$(".canvasbox").animate({width: elementwidth}, 500);
}
$(document).ready(function() {
resizecanvas();
var usedColor = "#91c46b";
var assiColor = "#287e7e";
var unliColor = "#56606e";