Blame view

frontend/web/js/new_script.js 4.09 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
  $(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')
10b789ee   Administrator   big commti
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
              $(this).parent().addClass('active');
              var status = $(this).data('status')
              switch (status) {
                  case 'new':
                      $.post( "/ajax/new",function( data ) {
                          $('.home-popular-slider').html(data);
                          $('#product_main_slider').owlCarousel({
                              navigation:true,
                              navigationText: [],
                              responsiveClass: true,
                              loop:true,
                              items:4,
                              mouseDrag:false,
                              navSpeed:200,
  
                          })
                      });
                      break;
                  case 'top':
                      $.post( "/ajax/top", function( data ) {
                          $('.home-popular-slider').html(data);
                          $('#product_main_slider').owlCarousel({
                              navigation:true,
                              navigationText: [],
                              responsiveClass: true,
                              loop:true,
                              items:4,
                              mouseDrag:false,
                              navSpeed:200,
  
                          })
                      });
                      break;
                  case 'prom':
                      $.post(  "/ajax/prom", function( data ) {
                          $('.home-popular-slider').html(data);
                          $('#product_main_slider').owlCarousel({
                              navigation:true,
                              navigationText: [],
                              responsiveClass: true,
                              loop:true,
                              items:4,
                              mouseDrag:false,
                              navSpeed:200,
  
                          })
                      });
                      break;
              }
2cbb3bdc   Виталий   test commit
131
132
133
134
135
136
137
          })
      }
  
  
  
  
  })