-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstart.js
55 lines (45 loc) · 1.36 KB
/
start.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$(function(){
'use strict';
var setTilesAreaSize = function(){
var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
var groups = $(".tiles-group");
var tileAreaWidth = 80;
$.each(groups, function(){
if (width <= Metro.media_sizes.LD) {
tileAreaWidth = width;
} else {
tileAreaWidth += $(this).outerWidth() + 80;
}
});
$(".tiles-area").css({
width: tileAreaWidth
});
if (width > Metro.media_sizes.LD) {
$(".start-screen").css({
overflow: "auto"
})
}
};
setTilesAreaSize();
$.each($('[class*=tile-]'), function(){
var tile = $(this);
setTimeout(function(){
tile.css({
opacity: 1,
"transform": "scale(1)",
"transition": ".3s"
}).css("transform", false);
}, Math.floor(Math.random()*500));
});
$(".tiles-group").animate({
left: 0
});
$(window).on(Metro.events.resize + "-start-screen-resize", function(){
setTilesAreaSize();
});
$(window).on(Metro.events.mousewheel, function(e){
var up = e.deltaY < 0 ? -1 : 1;
var scrollStep = 50;
$(".start-screen")[0].scrollLeft += scrollStep * up;
});
})