Sha256: 6e6e3037585c81a08eb6007b9c1262d75edaa52256415d31eed22596cc73931a
Contents?: true
Size: 985 Bytes
Versions: 1
Compression:
Stored size: 985 Bytes
Contents
#= require 'draggable' class OverlayMe.Overlays.DraggableImage extends OverlayMe.Draggable initialize: (attributes, options) -> super(attributes, options) @image = (new Backbone.View).make 'img', { src: options.image_src } $(@el).append @image # force positioning to 0 by default $(@el).css('left', '0px') if $(@el).css('left') == 'auto' || $(@el).css('left') == '' $(@el).css('top', '0px') if $(@el).css('top') == 'auto' || $(@el).css('top') == '' $(@el).bind 'mousedown', (event) => @toggleMove(event) $(window).bind 'mouseup', (event) => @endMove(event) $(@el).bind 'mouseover', (event) => $(".overlay-image-block[data-img-id=#{@id}]").addClass 'hovered' $(@el).bind 'mouseout', (event) => $(".overlay-image-block[data-img-id=#{@id}]").removeClass 'hovered' fitDivToImage: -> if @image.width > 0 $(@el).css('width', @image.width) $(@el).css('height', @image.height) render: -> @el
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
overlay_me-0.12.0 | javascripts/overlays/draggable_image.js.coffee |