Created
March 19, 2015 12:37
-
-
Save jakubstraka/548a95bbb8fe003d2d1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------ | |
# 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