         'padding-bottom': paddingV
       )
       height = @$current.height()
-      paddingH = "#{(width - @options.ratio*height)/2}px"
+      width = @options.ratio * height
+      paddingH = "#{(outerWidth - width)/2}px"
       @$sections.css(
         'padding-left':  paddingH
         'padding-right': paddingH
       )
     else
-      min = width
+      min = outerWidth / @options.ratio
       paddingH = @options.minPadding
       @$sections.css(
         'font-size':      "#{min * 0.4}%"

    $(window).on('hashchange', @checkHash)

  resize: ->
    [width, height] = [$(window).width(), $(window).height()]
    if width > height
      min = height
      paddingV = @options.minPadding
      @$sections.css(
        'font-size':      "#{min * 0.4}%"

        'padding-right': paddingH
      )
      width = @$current.width()
      height = width / @options.ratio
      paddingV = "#{(height - height)/2}px"
      @$sections.css(
        'padding-top':    paddingV,
        'padding-bottom': paddingV
