Sha256: cdea79af1a2ebaa995b0ca8272c49aa26deb6eba129b354b2c0c3fcfbd45fa8c

Contents?: true

Size: 800 Bytes

Versions: 4

Compression:

Stored size: 800 Bytes

Contents

$(document).ready ->
  element = document.getElementById("js-fadeInElement")
  $(element).addClass "js-fade-element-hide"
  $(window).scroll ->
    if $("#js-fadeInElement").length > 0
      elementTopToPageTop = $(element).offset().top
      windowTopToPageTop = $(window).scrollTop()
      windowInnerHeight = window.innerHeight
      elementTopToWindowTop = elementTopToPageTop - windowTopToPageTop
      elementTopToWindowBottom = windowInnerHeight - elementTopToWindowTop
      distanceFromBottomToAppear = 300
      if elementTopToWindowBottom > distanceFromBottomToAppear
        $(element).addClass "js-fade-element-show"
      else if elementTopToWindowBottom < 0
        $(element).removeClass "js-fade-element-show"
        $(element).addClass "js-fade-element-hide"
    return

  return

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
breezeblocks-0.0.4 source/javascripts/breezeblocks/coffeescript/fade_in.coffee
breezeblocks-0.0.2 source/javascripts/breezeblocks/coffeescript/fade_in.coffee
breezeblocks-0.0.1 source/javascripts/breezeblocks/coffeescript/fade_in.coffee
refills-0.1.0 source/javascripts/refills/coffeescript/fade_in.coffee