summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/view/ListView.js
blob: 5161a31ba616cbd0145d009162d329624e3f3df9 (plain)
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
var ListView = View.extend({

  el: "#list",

  events: {
    "click div": "load",
  },

  initialize: function(options){
    options = options || {}
    var data = this.data = options.data
  },
  
  render: function(){
    if (this.rendered) return
    this.rendered = true
  },

  show: function(){
    this.render(this.data)
    document.body.className = "listopen"
  },

  hide: function(){
    document.body.className = ""
    $(".visible").removeClass("visible")
    $("#nav a.active").removeClass('active')
  },
  
  load: function(e){
    var index = $(e.currentTarget).data("index")
    $.fn.fullpage.moveTo(index+1)
    console.log(index)
    this.hide()
  },
  
})