 
 
 
-    resize : -> @viewport_height = $(window).height()
+    resize : -> @viewport_height = window.innerHeight
 
     # Update 
     # Updates the position of the element with respect to the viewport. 

        @$el[0].style['-ms-transform'] = "translate(-#{@scroll_x}px, #{@scroll_y}px)"
        @$el[0].style['-moz-transform'] = "translate(-#{@scroll_x}px, #{@scroll_y}px)"

      # make sure that elements that don't scroll down past their container bottom
      if effective_viewport_top + element_height > container_bottom
        @$el[0].style['top'] = "#{container_bottom - element_height - viewport_top}px" 
      else if @$el[0].style['top'] != "#{@options.top_offset}px"
        @$el[0].style['top'] = "#{@options.top_offset}px"          


      @last_viewport_top = viewport_top


      @constructor.current_id += 1

      @$el = $(el)
      @scroll_y = @scroll_x = -1

      @is_stuck = false
      @last_viewport_top = document.documentElement.scrollTop || document.body.scrollTop

      $(window).on "resize.plugin_stickytopbottom-#{@my_id}", => @resize()
      $(window).on "scroll.plugin_stickytopbottom-#{@my_id}", => @update()

      $(document).on "touchend", => @update()

      @$el.on 'destroyed', $.proxy(@destroy, @) 

