Blame view

frontend/web/js/index.js 5.2 KB
69b58541   Виталий   new index header ...
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
  income();
  function income() {
      let switchBlock = document.querySelectorAll('.switch-status');
      for(let i = 0; i<switchBlock.length;i++) {
          switchBlock[i].onclick = function () {
              if(this.classList.contains('text')) {
                  if(!(this.classList.contains('active'))) {
                      switchBlock[0].classList.remove('active')
                      switchBlock[2].classList.remove('active')
                      this.classList.add('active')
                      if(i==0) {
                          switchBlock[1].classList.remove('right')
                      } else if (i == 2) {
                          switchBlock[1].classList.add('right')
                      }
  
                  }
              }
              if(this.classList.contains('switch')) {
                  if(switchBlock[0].classList.contains('active')) {
                      this.classList.add('right')
                      switchBlock[0].classList.remove('active')
                      switchBlock[2].classList.add('active')
                      this.parentNode.setAttribute('status',2)
                  } else if(switchBlock[2].classList.contains('active')) {
                      this.classList.remove('right')
                      switchBlock[0].classList.add('active')
                      switchBlock[2].classList.remove('active')
                      this.parentNode.setAttribute('status',0)
                  }
              }
              if(i != 1) {
                  this.parentNode.setAttribute('status',i)
              }
  
          }
  
      }
  
  
  
  }
d33ff9db   Виталий   new index header ...
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  homeText()
  function homeText() {
      let buttonText = document.querySelectorAll('.more-text__span');
      for (let i = 0; i< buttonText.length; i++) {
          buttonText[i].onclick = function () {
              let thisMore = this.getAttribute('data-more');
              let thisHide = this.getAttribute('data-hide');
              if (this.parentNode.parentNode.classList.contains('visible-text')) {
                  this.parentNode.parentNode.classList.remove('visible-text');
                  this.innerHTML = thisMore + '<i></i>';
              } else {
                  this.parentNode.parentNode.classList.add('visible-text');
                  this.innerHTML = thisHide + '<i></i>';
              }
          }
      }
  }
  
  
  
69b58541   Виталий   new index header ...
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  $(function() {
      sliderSolution();
      function sliderSolution() {
          let sliderBlock = document.querySelectorAll('.index-solution-slider');
          if(sliderBlock.length) {
              $(".index-solution-slider__row").owlCarousel(
                  {
                      navigation: true,
                      navigationText: [],
                      autoPlay: false,
                      rewindNav:false,
                      items: 4,
                      // itemsDesktopSmall: [
                      //     900,
                      //     3
                      // ],
                      // itemsTablet: [
                      //     600,
                      //     3
                      // ],
d33ff9db   Виталий   new index header ...
83
84
85
86
                      itemsMobile: [
                          550,
                          1
                      ]
69b58541   Виталий   new index header ...
87
88
89
90
91
92
                  });
          }
      }
  
      priceSlider1()
      function priceSlider1(){
d33ff9db   Виталий   new index header ...
93
94
95
96
97
98
99
100
101
          let price_interval = $('#price_interval');
          if(price_interval.length){
              let block = document.getElementsByClassName('calc-range-1')[0]
              let min = block.getAttribute('data-min');
              let max = block.getAttribute('data-max');
              let from = block.getAttribute('data-from');
  
              let marks = [2.5, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50];
              price_interval.ionRangeSlider({
69b58541   Виталий   new index header ...
102
                  grid: true,
d33ff9db   Виталий   new index header ...
103
                  step: 2.5,
69b58541   Виталий   new index header ...
104
105
106
107
                  grid_num: 10,
                  min: min,
                  max: max,
                  from: from,
d33ff9db   Виталий   new index header ...
108
109
                  from_min:5,
                  hide_from_to: false,
69b58541   Виталий   new index header ...
110
                  onChange: function (e) {
d33ff9db   Виталий   new index header ...
111
112
                      let value = +price_interval.val()
                      block.getElementsByClassName('irs-single')[0].classList.add('show')
69b58541   Виталий   new index header ...
113
114
                  },
                  onFinish: function(e) {
d33ff9db   Виталий   new index header ...
115
                      block.getElementsByClassName('irs-single')[0].classList.remove('show')
69b58541   Виталий   new index header ...
116
117
                  }
              });
69b58541   Виталий   new index header ...
118
          }
d33ff9db   Виталий   new index header ...
119
  
69b58541   Виталий   new index header ...
120
      }
d33ff9db   Виталий   new index header ...
121
  
69b58541   Виталий   new index header ...
122
123
      priceSlider2()
      function priceSlider2(){
d33ff9db   Виталий   new index header ...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
          let price_interval = $('#price_interval2')
  
          if(price_interval.length){
          let block = document.getElementsByClassName('calc-range-2')[0]
          let min = +block.getAttribute('data-min');
          let max = +block.getAttribute('data-max');
          let from = +block.getAttribute('data-from');
          price_interval.ionRangeSlider({
              grid: true,
              step: 100,
              grid_num: 5,
              min: min,
              max: max,
              from: from,
              hide_from_to: false,
              onChange: function (e) {
                  let value = +price_interval.val()
                  block.getElementsByClassName('irs-single')[0].classList.add('show')
              },
              onFinish: function(e) {
                  block.getElementsByClassName('irs-single')[0].classList.remove('show')
              }
          });
          }
      }
69b58541   Виталий   new index header ...
149
  
d33ff9db   Виталий   new index header ...
150
151
152
153
154
      $('.irs-slider').hover(function () {
          $(this).parent().find('.irs-single').addClass('hover');
      }, function () {
          $(this).parent().find('.irs-single').removeClass('hover');
      })
69b58541   Виталий   new index header ...
155
156
  
  
69b58541   Виталий   new index header ...
157
  
d33ff9db   Виталий   new index header ...
158
  });