Files
nairobi/app/assets/javascripts/foundation_extras.js.coffee
Javi Martín 86e704d8a4 Use strict mode in JavaScript
Strict mode is supported by 98% of the browsers, including Internet
Explorer 10, and it helps developers avoid common JavaScript pitfalls.
2019-09-11 03:14:17 +02:00

24 lines
601 B
CoffeeScript

"use strict"
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: ->
$(document).foundation()
$(window).trigger "resize"
$(document).on("page:before-unload", this.clearSticky)
window.addEventListener("popstate", this.clearSticky, false)
$ ->
if $(window).width() < 620
App.FoundationExtras.mobile_ui_init()
else
App.FoundationExtras.desktop_ui_init()