var my_array = [100, 200, 300, 600, 900, 1500, 2000],
max = 1000;
function getMax () {
var temp = [];
for (var i = 0; i < my_array.length; i++) {
if (my_array[i] <= max) {
temp.push(my_array[i]);
}
}
temp.sort().reverse();
return temp[0];
}
var my_max = getMax();
console.log(my_max);
<div class='anim'>
<div class='animated anim-bg-1'></div>
<div class='animated anim-bg-2'></div>
<div class='animated anim-bg-1 dop'></div>
</div>
<div class='page'>
<p>Контент страницы</p>
</div>
.anim {
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
overflow: hidden;
}
@keyframes GO {
0% { transform: translate(0, 0); }
100% { transform: translate(0, -200%); }
}
.animated {
animation: GO 7s infinite;
}
.anim-bg-1 {
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
background: red;
}
.dop {
top: 200%;
}
.anim-bg-2 {
position: absolute;
top: 100%; left: 0;
width: 100%; height: 100%;
background: green;
}
.page {
position: absolute;
top: 0; left: 0;
width: 100%;
color: #fff;
}
body {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.selectable {
-webkit-touch-callout: all;
-webkit-user-select: all;
-khtml-user-select: all;
-moz-user-select: all;
-ms-user-select: all;
user-select: all;
}