diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-11-22 18:45:35 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-11-22 18:45:35 -0500 |
| commit | 654e25288a73bd41d1756771297c758e6fbd55a0 (patch) | |
| tree | 783616dd668d8a9d4da5a9eae2ddffd5710d53e9 /public/assets/js/nav.js | |
| parent | 1fabc62ef743aec0bdb9a5219163d8e4cd59174a (diff) | |
mobile layout
Diffstat (limited to 'public/assets/js/nav.js')
| -rw-r--r-- | public/assets/js/nav.js | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/public/assets/js/nav.js b/public/assets/js/nav.js index e86c8cd..ae6fabe 100644 --- a/public/assets/js/nav.js +++ b/public/assets/js/nav.js @@ -2,10 +2,13 @@ var NavView = View.extend({ el: "body", events: { - "click #prev": "prev", - "click #next": "next", - "click #refresh": "refresh", - "click #random": "random", + "click .prev": "prev", + "click .next": "next", + "touchstart .prev": "prev", + "touchstart .next": "next", + "touchstart .link": "link", + "click .refresh": "refresh", + "click .random": "random", }, initialize: function(){ @@ -30,6 +33,13 @@ var NavView = View.extend({ else { this.latest() } + + $(".prev").on("touchstart", function(){ + console.log("<<<<<PREV") + }) + $(".prev").on("click", function(){ + console.log("<<<<<CLICKPREV") + }) }, keydown: function(e){ @@ -88,11 +98,18 @@ var NavView = View.extend({ this.onLatest = true return } + this.data = data this.id = data.id - this.$pip.attr("href", data.url) - this.$pip_img.attr("src", "") - setTimeout(function(){ this.$pip_img.attr("src", data.url) }.bind(this)) + if (is_desktop) { + this.$pip.attr("href", data.url) + this.$pip_img.attr("src", "") + setTimeout(function(){ this.$pip_img.attr("src", data.url) }.bind(this)) + } this.$image.css("background-image", "url(" + data.url + ")") }, + + link: function(){ + window.open(this.data.url, "_blank") + }, }) |
