Sha256: 75df3bfa998fe80d43c76bb7f2aa0bf00ecb5ba9de584213c3b53f74fd027b81

Contents?: true

Size: 1.59 KB

Versions: 8

Compression:

Stored size: 1.59 KB

Contents

@init_tusur_header_observer = ->

  first_menu = $('#menu_first')
  second_menu = $('#menu_second')

  #для мобилок
  if window.innerWidth < 750
    $('.has_arrow', first_menu).removeClass('has_arrow')

  dropdown_menus = $('ul.nav.navbar-nav', first_menu).not('.navbar-right')
  return true if dropdown_menus.length < 2

  site_menu = dropdown_menus[1]
  site_menu_caret = $('.caret', site_menu)
  site_menu_toggle = $('.dropdown-toggle', site_menu)
  site_menu_toggle.click (e) ->
    false if $(e.target).hasClass('disabled')

  site_menu_caret.hide = () ->
    if this.hasClass('caret')
      this.addClass('tmp_caret')
      this.removeClass('caret')
    true

  site_menu_caret.show = () ->
    if this.hasClass('tmp_caret')
      this.removeClass('tmp_caret')
      this.addClass('caret')
    true

  site_menu_caret.hide()
  site_menu_toggle.addClass('disabled')

  $('.auth_block .dropdown').click ->
    cloud = $('.ntf_cloud')
    cloud.hide().html('') if cloud.is(':visible')

  $(window).scroll () ->
    footer_height = $('#footer').height()
    new_footer_height = footer_height + 40

    if $(window).scrollTop() > 0
      first_menu.css('border-bottom', 'solid 1px #ccc')
      site_menu_caret.show()
      site_menu_toggle.removeClass('disabled')

      $('#wrapper').css('margin-bottom', "0px")

    if $(window).scrollTop() == 0
      first_menu.css('border-bottom', 'none')
      site_menu_caret.hide()
      site_menu_toggle.click() if site_menu_toggle.parent().hasClass('open')
      site_menu_toggle.addClass('disabled')

      $('#wrapper').css('margin-bottom', "-#{new_footer_height}px")

  true

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tusur_header-0.1.9 vendor/assets/javascripts/tusur_header_observer/init.js.coffee
tusur_header-0.1.8 vendor/assets/javascripts/tusur_header_observer/init.js.coffee
tusur_header-0.1.7 vendor/assets/javascripts/tusur_header_observer/init.js.coffee
tusur_header-0.1.6 vendor/assets/javascripts/tusur_header_observer/init.js.coffee
tusur_header-0.1.5 vendor/assets/javascripts/tusur_header_observer/init.js.coffee
tusur_header-0.1.4 vendor/assets/javascripts/tusur_header_observer/init.js.coffee
tusur_header-0.1.3 vendor/assets/javascripts/tusur_header_observer/init.js.coffee
tusur_header-0.1.2 vendor/assets/javascripts/tusur_header_observer/init.js.coffee