summaryrefslogtreecommitdiff
path: root/site/public/assets/javascripts/_env.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2015-05-11 18:27:51 +0100
committerJulie Lala <jules@okfoc.us>2015-05-11 18:27:51 +0100
commitca364c2cee66002d35b7e5c8c675b7191563ae4f (patch)
tree67aaa20b8aa93febdb090972650909ef785a6dc8 /site/public/assets/javascripts/_env.js
parent45bedcb1caced064c44f39927a94e5c26aaee146 (diff)
fixing most of the mobile shit
Diffstat (limited to 'site/public/assets/javascripts/_env.js')
-rw-r--r--site/public/assets/javascripts/_env.js51
1 files changed, 32 insertions, 19 deletions
diff --git a/site/public/assets/javascripts/_env.js b/site/public/assets/javascripts/_env.js
index b6b5785..f940389 100644
--- a/site/public/assets/javascripts/_env.js
+++ b/site/public/assets/javascripts/_env.js
@@ -184,19 +184,21 @@ environment.ready = function(){
toggle_menu()
}
})
- $(document).on("mouseenter", ".project", function(){
- var type = $(this).data("type")
- $(".entry").addClass("hover")
- $(this).addClass("hover")
- $(".top .cat").not("[data-type=" + type + "]").addClass("no-hover")
- $(".cat[data-type=" + type + "]").addClass("hover")
- })
- $(document).on("mouseleave", ".project", function(){
- var type = $(this).data("type")
- $(".entry").removeClass("hover")
- $(this).removeClass("hover")
- $(".cat").removeClass("hover").removeClass("no-hover")
- })
+ if (is_desktop) {
+ $(document).on("mouseenter", ".project", function(){
+ var type = $(this).data("type")
+ $(".entry").addClass("hover")
+ $(this).addClass("hover")
+ $(".top .cat").not("[data-type=" + type + "]").addClass("no-hover")
+ $(".cat[data-type=" + type + "]").addClass("hover")
+ })
+ $(document).on("mouseleave", ".project", function(){
+ var type = $(this).data("type")
+ $(".entry").removeClass("hover")
+ $(this).removeClass("hover")
+ $(".cat").removeClass("hover").removeClass("no-hover")
+ })
+ }
}
@@ -305,15 +307,17 @@ function load_index (e){
e && e.preventDefault()
// if (done_loading && window.location.hash == "#/index") return
// window.location.hash = "#/index"
- console.log("load index")
+ // console.log("load index")
$("nav a.active").removeClass("active")
- open_entry()
+ open_entry(true)
+
+ window.location.hash = "#"
$("#entry_container").removeClass("visible")
var $loader = $("<div>")
$loader.load("all .entry", function(){
- console.log("index did load")
+ $("body").addClass("menuActive")
display_entry($loader.children()[0])
})
}
@@ -328,8 +332,8 @@ function load_hash (hash) {
$menu.parent().prev(".cat").addClass('active')
$menu.trigger("click")
}
-function open_entry () {
- if (is_mobile) {
+function open_entry (entryIsAll) {
+ if (is_mobile && ! entryIsAll) {
$("body").removeClass("menuActive")
}
if (! entry_open) {
@@ -344,10 +348,17 @@ function open_entry () {
}
function display_entry ($el) {
var now = +new Date
+ console.log("Has all", $el, $($el).hasClass("all"))
+ if (is_mobile) {
+ $("body").toggleClass("menuActive", $($el).hasClass("all"))
+ $($el).find(".brady").remove()
+ }
setTimeout(function(){
$("#entry_container").empty().append($el)
$("#entry_container").removeClass("fade")
- build_gallery()
+ setTimeout(function(){
+ build_gallery()
+ })
if (is_mobile) {
$(".video").each(function(){
load_video( $(this) )
@@ -470,12 +481,14 @@ function build_gallery () {
})
gallery.on("cellSelect", function(){
+ if (! gallery.selectedElement) return
$caption.html( $(gallery.selectedElement).data("caption") )
videos.forEach(function(player){
player.api('pause')
})
})
gallery.on("settle", function(){
+ if (! gallery || ! gallery.selectedElement) { return }
$caption.html( $(gallery.selectedElement).data("caption") )
})
gallery.on("staticClick", function(e){