Blame view

frontend/web/js/new_script.js 2.24 KB
2cbb3bdc   Виталий   test commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
  $(document).ready(function () {
      showSubMenu();
      activeSubMEnu();
      allSeoTxt();
      loadNewCarousel();
  
  
      function showSubMenu() {
          var timeout;
          var timeout2;
          $('.new_catalog').hover(function () {
              var this_ = $(this)
              timeout = setTimeout(function () {
                  this_.addClass('show')
  
  
                  if(!$('.main-cat_ ul li.act').length) {
  
                      $('.main-cat_ ul li:first-child').addClass('act')
  
  
                      $('.sub-cat_ ul:first-child').addClass('active-show')
                  }
  
              },200)
  
              clearTimeout(timeout2)
  
  
          },function () {
              var this_ = $(this)
              clearTimeout(timeout)
              timeout2 = setTimeout(function () {
                  this_.removeClass('show')
                  $('.main-cat_ ul li').removeClass('act')
                  $('.sub-cat_ ul').removeClass('active-show')
              },200)
  
          })
      }
  
      function  activeSubMEnu() {
          var timeout;
          var timeout2;
          $('.main-cat_ ul li').hover(function () {
              var this_ = $(this)
              var thisIndex = this_.index()
              var subIndex = $('.sub-cat_ ul')
  
             timeout = setTimeout(function () {
                  $('.main-cat_ ul li').removeClass('act')
                  this_.addClass('act')
                 $('.sub-cat_ ul').removeClass('active-show')
                 $(subIndex[thisIndex]).addClass('active-show')
              },200)
              clearTimeout(timeout2)
  
  
          },function () {
              clearTimeout(timeout)
          })
      }
  
      function allSeoTxt() {
          var txt1 = 'Развернуть текст';
          var txt2 = 'Свернуть';
          $('.all_seo_text').click(function (e) {
              e.preventDefault()
              $('.seo-text').toggleClass('show')
              $(this).toggleClass('show')
              if($(this).hasClass('show')) {
                  $(this).html(txt2)
              } else {$(this).html(txt1)}
          })
      }
  
      
      function  loadNewCarousel() {
          $('.home-popular li a').click(function (e) {
              e.preventDefault();
              $('.home-popular li a').parent().removeClass('active')
              $(this).parent().addClass('active')
          })
      }
  
  
  
  
  })