 		if scope.ratio and not scope.height
 			scope.height = scope.destinationHeight
 		scope.type ||= "png"
+
+	offset = (el) ->
+		el = el[0] if el[0]
+		marginTop = window.getComputedStyle(el, null).getPropertyValue("margin-top")
+		marginLeft = window.getComputedStyle(el, null).getPropertyValue("margin-left")
+		offsetTop = -parseInt(marginTop, 10)
+		offsetLeft = -parseInt(marginLeft, 10)
+		while el
+			offsetTop += el.offsetTop
+			offsetLeft += el.offsetLeft
+			el = el.offsetParent
+		top: offsetTop
+		left: offsetLeft
 
 	template: """
 		<div

			else draggingFn = moveCropZone
			draggingFn(e)
		scope.mouseup = (e) -> 
			draggingFn(e)
			draggingFn = null
		scope.mousemove = (e) ->
			draggingFn(e) if draggingFn

					checkVRatio()

		isNearBorders = (coords) ->
			offset = offset imageAreaEl
			x = scope.xCropZone + offset.left
			y = scope.yCropZone + offset.top
			w = scope.widthCropZone
			h = scope.heightCropZone
			topLeft = { x: x, y: y }
