Make WordPress Themes

source: total/1.1.2/js/total-custom.js @ 215066

Last change on this file since 215066 was 68167, checked in by themedropbox, 7 years ago

New version of Total - 1.1.2

File size: 6.0 KB
Line 
1/**
2 * Total Custom JS
3 *
4 * @package Total
5 *
6 * Distributed under the MIT license - http://opensource.org/licenses/MIT
7 */
8
9jQuery(function($){
10
11  if($('.ht-sticky-header').length > 0){
12    $(window).scroll(function(){
13      if($(window).scrollTop() > 200 ){
14        $('#ht-masthead').addClass('ht-sticky');
15      }else{
16        $('#ht-masthead').removeClass('ht-sticky');
17      }
18    });
19  }
20
21  if($('#ht-bx-slider .ht-slide').length > 0){
22    $('#ht-bx-slider').bxSlider({
23        'pager':false,
24        'auto' : true,
25        'mode' : 'fade',
26        'pause' : 5000,
27    });
28  }
29
30  $('.ht-testimonial-slider').bxSlider({
31      'controls' : true,
32      'pager': false,
33      'auto' : true,
34      'pause' : 5000,
35      'mode' : 'fade',
36      'prevText' : '<i class="fa fa-angle-left" aria-hidden="true"></i>',
37      'nextText' : '<i class="fa fa-angle-right" aria-hidden="true"></i>',
38  });
39
40  $(".ht_client_logo_slider").owlCarousel({
41      autoPlay: 4000,
42      items : 5,
43      itemsDesktop : [1199,5],
44      itemsDesktopSmall : [979,4],
45      itemsTablet: [768,3],
46      itemsMobile: [479,2],
47      pagination : false
48  });
49   
50  $('.ht-portfolio-image').nivoLightbox();
51 
52  $('.ht-menu > ul').superfish({
53      delay:       500,                            // one second delay on mouseout
54      animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation
55      speed:       'fast',                          // faster animation speed
56  });
57   
58  $('.ht-service-excerpt h5').click(function(){
59      $(this).next('.ht-service-text').slideToggle();
60      $(this).parents('.ht-service-post').toggleClass('ht-active');
61  });
62 
63  $('.ht-service-icon').click(function(){
64      $(this).next('.ht-service-excerpt').find('.ht-service-text').slideToggle();
65      $(this).parent('.ht-service-post').toggleClass('ht-active');
66  });
67
68  $('.toggle-bar').click(function(){
69      $(this).next('.ht-menu').slideToggle();
70  });
71
72  setTimeout(function(){
73    $.stellar({
74      horizontalScrolling: false, 
75      responsive: true,
76    });
77  }, 3000 );
78 
79  $('.ht-team-counter-wrap').waypoint(function() {
80      setTimeout(function() {
81          $('.odometer1').html($('.odometer1').data('count'));
82      }, 500);
83      setTimeout(function() {
84          $('.odometer2').html($('.odometer2').data('count'));
85      }, 1000);
86      setTimeout(function() {
87          $('.odometer3').html($('.odometer3').data('count'));
88      }, 1500);
89      setTimeout(function() {
90          $('.odometer4').html($('.odometer4').data('count'));
91      }, 2000);
92      }, {
93      offset: 800,
94      triggerOnce: true
95  });
96
97  if($('.ht-sticky-header').length > 0){
98    var onpageOffset = 74;
99  }else{
100    onpageOffset = 0
101  }
102
103  $('.ht-sticky-header .ht-menu').onePageNav({
104    currentClass: 'current',
105    changeHash: false,
106    scrollSpeed: 750,
107    scrollThreshold: 0.1,
108    scrollOffset: onpageOffset
109  });
110
111 // *only* if we have anchor on the url
112  if(window.location.hash) {
113      $('html, body').animate({
114          scrollTop: $(window.location.hash).offset().top - onpageOffset
115      }, 1000 );       
116  }
117
118  $(window).scroll(function(){
119      if($(window).scrollTop() > 300){
120          $('#ht-back-top').removeClass('ht-hide');
121      }else{
122          $('#ht-back-top').addClass('ht-hide');
123      }
124  });
125
126  $('#ht-back-top').click(function(){
127      $('html,body').animate({scrollTop:0},800);
128  });
129
130  if( $('.ht-portfolio-posts').length > 0 ){
131
132  var first_class = $('.ht-portfolio-cat-name:first').data('filter');
133  $('.ht-portfolio-cat-name:first').addClass('active');
134
135  var $container = $('.ht-portfolio-posts').imagesLoaded( function() {
136 
137  $container.isotope({
138      itemSelector: '.ht-portfolio',
139      filter: first_class
140  });
141       
142  var elems = $container.isotope('getFilteredItemElements');
143
144  elems.forEach(function(item, index){
145    if ( index == 0 || index == 4 ) {
146      $( item ).addClass('wide');
147      var bg = $(item).find('.ht-portfolio-image').attr('href');
148      $( item ).find('.ht-portfolio-wrap').css('background-image', 'url('+bg+')');
149    }else{
150      $( item ).removeClass('wide');
151    }
152  });
153
154  GetMasonary();
155
156  setTimeout(function(){
157    $container.isotope({
158    itemSelector: '.ht-portfolio',
159    filter: first_class,
160  });
161  },2000);
162
163  $(window).on( 'resize', function () {
164     GetMasonary();
165  });
166
167}); 
168
169$('.ht-portfolio-cat-name-list').on( 'click', '.ht-portfolio-cat-name', function() {
170  var filterValue = $(this).attr('data-filter');
171  $container.isotope({ filter: filterValue });
172       
173    var elems = $container.isotope('getFilteredItemElements');
174   
175    elems.forEach(function(item, index){
176      if ( index == 0 || index == 4 ) {
177        $( item ).addClass('wide');
178        var bg = $(item).find('.ht-portfolio-image').attr('href');
179        $( item ).find('.ht-portfolio-wrap').css('background-image', 'url('+bg+')');
180      }else{
181        $( item ).removeClass('wide');
182      }
183    }); 
184
185    GetMasonary();     
186 
187          var filterValue = $(this).attr('data-filter');
188          $container.isotope({ filter: filterValue });
189       
190          $('.ht-portfolio-cat-name').removeClass('active');
191          $(this).addClass('active');
192});
193
194function GetMasonary(){       
195   var winWidth = window.innerWidth;   
196   if (winWidth > 580) {
197                   
198      $container.find('.ht-portfolio').each(function () { 
199          var image_width = $(this).find('img').width();
200          if($(this).hasClass('wide')){
201            $(this).find('.ht-portfolio-wrap').css( { 
202                height : (image_width*2) + 15 + 'px'
203            });
204          }else{
205            $(this).find('.ht-portfolio-wrap').css( { 
206                height : image_width + 'px'
207            });
208          }
209      }); 
210
211  }else {
212      $container.find('.ht-portfolio').each(function () { 
213          var image_width = $(this).find('img').width();
214          if($(this).hasClass('wide')){
215            $(this).find('.ht-portfolio-wrap').css( { 
216                height : (image_width*2) + 8 + 'px'
217            });
218          }else{
219            $(this).find('.ht-portfolio-wrap').css( { 
220                height : image_width + 'px'
221            });
222          }
223      }); 
224  }   
225}
226
227}
228
229});
230
Note: See TracBrowser for help on using the repository browser.