       if r.visibleItems > 1 then Math.max(0, 1.0 - Math.pow(l / r.visibleItems, 2)) else 0
     funcSize: (l, r, i) ->
       1
+
+    fitContainer: (r) ->
+      parentContainer = r.container.parent()
+      newWidth = parentContainer.innerWidth()
+      newHeight = parentContainer.innerHeight()
+
+      r.log newWidth
+      r.log newHeight
+
+      $.extend true, r,
+        size:
+          width: newWidth
+          height: newHeight
+        center:
+          left: newWidth / 2
+          top: newHeight / 2
+        radius:
+          x: newWidth / 2 - r.itemProperties.size.width
+          y: newHeight / 2 - r.itemProperties.size.height
+
+      r.container.css
+        width: newWidth
+        height: newHeight
+
+      r.shiftTo r.currentLayer
     
     showCaption: (idx) => 
       if @captionsEnabled

        @container.bind("touchstart touchmove touchend", @_onTouch) if @touch.enabled
      else
        # Add hover and touch functions to container when we don't have touch support
        @container.bind("mouseenter mouseleave", @_hover)
        
      @container.removeClass @classes.initializing
          
      # Fire callback after initialization with rondell instance if callback was provided
      @initCallback?(@)
      
      # Move items to starting positions
      @_focusedItem ?= @_getItem @currentLayer
      @shiftTo @currentLayer
      
    _onMobile: ->
      ###
      Mobile device detection. 

      newX = Math.round((position - @start) / (@end - @start) * (@_maxX - @_minX)) + @_minX
      @scrollTo newX, true, fireCallback

    onDrag: (e) =>
      e.preventDefault()
      return unless @_drag._dragging

      if e.type is "mouseup"
        # Release drag on mouseup
        @_drag._dragging = false
        @scrollControl.removeClass @classes.dragging
        # Bind mouse events to window for dragging
        $(window).unbind "mousemove mouseup", @onDrag
      else
        # Move scroll dot to new position
        newX = 0
        if @orientation in ["top", "bottom"]
          newX = e.pageX - @container.offset().left
        else
          newX = e.pageY - @container.offset().top
        newX = Math.max(@_minX, Math.min(@_maxX, newX))

        @scrollTo newX, false

    onDragStart: (e) =>
      e.preventDefault()
      # Start drag event
      @_drag._dragging = true
      @scrollControl.addClass @classes.dragging
      # Bind mouse events to window for dragging
      $(window).bind "mousemove mouseup", @onDrag
      
    onScrollbarClick: (e) =>
      # Jump to new position when clicking scroller background
      @scrollTo e.pageX - @container.offset().left
      
    scrollLeft: (e) =>
      e.preventDefault()
