-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollapsable.js
More file actions
46 lines (40 loc) · 996 Bytes
/
collapsable.js
File metadata and controls
46 lines (40 loc) · 996 Bytes
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
var scale = 0.25
, distns = parseInt($('.item img').css("height") )* (1 - 0.25);
$('.list').mouseenter(function (e) {
var a = list();
if(a[1].parent().parent().css("top") == "55px") {
expand(a, distns);
}
});
$('.list').mouseleave(function (e) {
var a = list();
collapse(a, distns);
});
function list() {
var a = [];
a.push($('.select img'));
a.push($('.add img'));
a.push($('.edit img'));
a.push($('.share img'));
return a;
}
function move(a, distns, scale) {
var len = a.length
, toTop;
for(var i = 0; i < len; i++) {
a[i].css("-webkit-transform","scale(1," + scale +")");
a[i].css("-moz-transform","scale(1," + scale +")");
a[i].css("-ms-transform","scale(1," + scale +")");
if(a[i + 1]) {
for(var j = i + 1; j < len; j++) {
toTop = a[j].parent().parent().css("top");
a[j].parent().parent().css("top",parseInt(toTop) + distns);
}
}
}
}
function expand(a, distns) {
move(a,distns,1);
};
function collapse(a, distns) {
move(a, -1*distns, scale)};