Skip to content

Instantly share code, notes, and snippets.

@jakubstraka
Created March 19, 2015 12:37
Show Gist options
  • Save jakubstraka/548a95bbb8fe003d2d1f to your computer and use it in GitHub Desktop.
Save jakubstraka/548a95bbb8fe003d2d1f to your computer and use it in GitHub Desktop.
# ------------------------------------------------------
# Page
Page = {}
# ------------------------------------------------------
# Page App
class Page.App
constructor: ->
@layout = new Page.Layout($('section.page'))
start: =>
# App init
# ------------------------------------------------------
# Page Layout
class Page.Layout
constructor: (@dom) ->
@data = @dom.data()
@links = $('.menu, .link')
@setBackground()
@setLinkColor()
setLinkColor: =>
@links.css 'color', @data.fontColor
setLinkHover: =>
@links.hover ->
console.log 'hover!'
@css 'color', @hoverColor
setBackground: =>
@dom.css
color: @data.fontColor
backgroundColor: @data.bgColor unless @data.bgColor is null
backgroundImage: 'url('+@data.bgImage+')' unless @data.bgImage is null
backgroundRepeat: @data.bgRepeat unless @data.bgRepeat is 'cover'
backgroundSize: 'cover' if @data.bgRepeat is 'cover'
# ------------------------------------------------------
# Ready
$(document).on 'ready page:load', =>
if $('body').hasClass('pages show')
page = new Page.App()
page.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment