Sha256: 42a70423691ba0a113685a720b4d4253df2b1a4be287a72effadcacd7feed1c0

Contents?: true

Size: 1.4 KB

Versions: 13

Compression:

Stored size: 1.4 KB

Contents

$ ->
  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 () ->

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

    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')

  return

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tusur_header-0.2.17 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.15 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.14 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.13 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.12 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.11 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.10 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.9 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.8 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.7 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.6 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.5 vendor/assets/javascripts/tusur_header_observer.js.coffee
tusur_header-0.2.4 vendor/assets/javascripts/tusur_header_observer.js.coffee