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
56
57
58
59
60
|
var projectListTimeout = null
var ProjectList = View.extend({
el: ".projectList",
events: {
"mouseenter .room": 'enter',
"mouseleave .room": 'leave',
},
initialize: function(){
this.$(".images").each(function(){
$divs = $(this).children("div")
$divs.hide()
$divs.first().show()
$(this).data("index", 0)
})
},
timeout: null,
enter: function(e){
clearTimeout(projectListTimeout)
this.advance(e.currentTarget)
},
leave: function(e){
clearTimeout(projectListTimeout)
var $divs = $(e.currentTarget).find(".images div")
$divs.hide()
$divs.eq(0).show()
},
advance: function(el){
projectListTimeout = setTimeout(function(){
this.advance(el)
}.bind(this), 500)
var $images = $(el).find(".images")
var $divs = $images.children("div")
var index = $images.data("index")
var nextIndex = (index + 1) % $divs.length
$divs.eq(index).hide()
$divs.eq(nextIndex).show()
$images.data("index", nextIndex)
}
/*
spinOn: function(e){
var iframe = $(e.currentTarget).find("iframe").get('0')
if (! iframe) return
iframe.contentWindow.postMessage("spin-on", window.location.origin)
},
spinOff: function(e){
var iframe = $(e.currentTarget).find("iframe").get('0')
if (! iframe) return
iframe.contentWindow.postMessage("spin-off", window.location.origin)
}
*/
})
|