Extract functions in foundation extras
In foundation extras we were assigning functions to local variables, but in the rest of the CoffeeScript files we use them as object properties.
This commit is contained in:
@@ -1,24 +1,21 @@
|
|||||||
App.FoundationExtras =
|
App.FoundationExtras =
|
||||||
|
clearSticky: ->
|
||||||
|
$("[data-sticky]").foundation("destroy") if $("[data-sticky]").length
|
||||||
|
|
||||||
|
mobile_ui_init: ->
|
||||||
|
$(window).trigger "load.zf.sticky"
|
||||||
|
|
||||||
|
desktop_ui_init: ->
|
||||||
|
$(window).trigger "init.zf.sticky"
|
||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
$(document).foundation()
|
$(document).foundation()
|
||||||
$(window).trigger "resize"
|
$(window).trigger "resize"
|
||||||
|
$(document).on("page:before-unload", this.clearSticky)
|
||||||
clearSticky = ->
|
window.addEventListener("popstate", this.clearSticky, false)
|
||||||
$("[data-sticky]").foundation("destroy") if $("[data-sticky]").length
|
|
||||||
|
|
||||||
$(document).on("page:before-unload", clearSticky)
|
|
||||||
|
|
||||||
window.addEventListener("popstate", clearSticky, false)
|
|
||||||
|
|
||||||
mobile_ui_init = ->
|
|
||||||
$(window).trigger "load.zf.sticky"
|
|
||||||
|
|
||||||
desktop_ui_init = ->
|
|
||||||
$(window).trigger "init.zf.sticky"
|
|
||||||
|
|
||||||
$ ->
|
$ ->
|
||||||
if $(window).width() < 620
|
if $(window).width() < 620
|
||||||
do mobile_ui_init
|
App.FoundationExtras.mobile_ui_init()
|
||||||
else
|
else
|
||||||
do desktop_ui_init
|
App.FoundationExtras.desktop_ui_init()
|
||||||
|
|||||||
Reference in New Issue
Block a user