$(document).on 'click', "a[href*='#']:not([href^='#'])", (e) ->
  if location.hostname == this.hostname
    target = $(this.hash)
    target = if target.length then target else $('[name=' + this.hash.slice(1) + ']')
    if target.length
      $('html,body').animate {scrollTop: target.offset().top - $('#landing_header .nav_menu:not(.mobile_menu):visible').height()}, 500
      e.preventDefault()
      false

$(document).on 'click', "a[href='#{location.pathname}']", (e) ->
  $('html,body').animate {scrollTop: 0}, 500
  e.preventDefault()
  false