Skip to content

Instantly share code, notes, and snippets.

@jejacks0n
Created December 9, 2013 16:57
Show Gist options
  • Save jejacks0n/7875807 to your computer and use it in GitHub Desktop.
Save jejacks0n/7875807 to your computer and use it in GitHub Desktop.
class @Mercury.Regions.BackgroundImage extends @Mercury.Regions.Image
@supported: document.getElementById
@supportedText: "Chrome 10+, Firefox 4+, IE 7+, Safari 5+, Opera 8+"
type = 'backgroundImage'
type: -> type
pushHistory: () ->
@history.push(src: @element.css('background-image'))
updateSrc: (src) ->
if src.match(/^url/)
@element.css('background-image', src)
else
@element.css('background-image', "url(#{src})")
serialize: ->
return {
type: type
data: @dataAttributes()
attributes:
'background-image': @element.css('background-image')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment