1;// Themify Theme Scripts - http://themify.me/ 2 3// Initialize object literals 4var FixedHeader = {}, 5 ThemeTransition = {}; 6 7///////////////////////////////////////////// 8// jQuery functions 9///////////////////////////////////////////// 10(function($){ 11 12// Initialize carousels ////////////////////////////// 13function createCarousel(obj) { 14 obj.each(function() { 15 var $this = $(this); 16 $this.carouFredSel({ 17 responsive : true, 18 prev : '#' + $this.data('id') + ' .carousel-prev', 19 next : '#' + $this.data('id') + ' .carousel-next', 20 pagination : { 21 container : '#' + $this.data('id') + ' .carousel-pager' 22 }, 23 circular : true, 24 infinite : true, 25 scroll : { 26 items : 1, 27 wipe : true, 28 fx : $this.data('effect'), 29 duration : parseInt($this.data('speed')) 30 }, 31 auto : { 32 play : !!('off' != $this.data('autoplay')), 33 pauseDuration : 'off' != $this.data('autoplay') ? parseInt($this.data('autoplay')) : 0 34 }, 35 items : { 36 visible : { 37 min : 1, 38 max : 1 39 }, 40 width : 222 41 }, 42 onCreate : function() { 43 $this.closest('.slideshow-wrap').css({ 44 'visibility' : 'visible', 45 'height' : 'auto' 46 }); 47 var $testimonialSlider = $this.closest('.testimonial.slider'); 48 if( $testimonialSlider.length > 0 ) { 49 $testimonialSlider.css({ 50 'visibility' : 'visible', 51 'height' : 'auto' 52 }); 53 } 54 $(window).resize(); 55 } 56 }); 57 }); 58} 59 60// Test if touch event exists ////////////////////////////// 61function is_touch_device() { 62 return 'true' == themifyScript.isTouch; 63} 64 65// Fixed Header ///////////////////////// 66FixedHeader = { 67 init: function() { 68 var cons = 10; 69 this.headerHeight = $('#headerwrap').height() - cons; 70 this.headerOffset = $('#headerwrap').offset().top; 71 $(window) 72 .on('scroll', this.activate) 73 .on('touchstart.touchScroll', this.activate) 74 .on('touchmove.touchScroll', this.activate); 75 if ( is_touch_device() ) { 76 $('body').addClass('mobile-body'); 77 } 78 }, 79 80 activate: function() { 81 var $window = $(window), 82 scrollTop = $window.scrollTop(); 83 84 if( scrollTop > ( FixedHeader.headerHeight + FixedHeader.headerOffset ) ) { 85 FixedHeader.scrollEnabled(); 86 87 if ( is_touch_device() ) { 88 setTimeout(function(){ 89 FixedHeader.scrollEnabled(); 90 }, 100); 91 } 92 } else { 93 FixedHeader.scrollDisabled(); 94 if ( is_touch_device() ) { 95 setTimeout(function(){ 96 FixedHeader.scrollDisabled(); 97 }, 100); 98 } 99 } 100 }, 101 102 scrollDisabled: function() { 103 $('#headerwrap').removeClass('fixed-header'); 104 $('#header').removeClass('header-on-scroll'); 105 $('#pagewrap').css('padding-top', ''); 106 $('body').removeClass('fixed-header-on'); 107 }, 108 109 scrollEnabled: function() { 110 $('#headerwrap').addClass('fixed-header'); 111 $('#header').addClass('header-on-scroll'); 112 $('#pagewrap').css('padding-top', FixedHeader.headerHeight); 113 $('body').addClass('fixed-header-on'); 114 } 115}; 116 117// Theme Transition Animation ///////////////////////// 118ThemeTransition = { 119 init: function() { 120 this.setup(); 121 }, 122 setup: function() { 123 if ( typeof s !== 'undefined') { 124 // shortcode columns add class 125 $('.col2-1.first, .col3-1.first, .col3-2.first, .col4-1.first, .col4-2.first, .col4-3.first').each(function(){ 126 var $this = $(this); 127 if($this.hasClass('col2-1')) { 128 $this.next('.col2-1').addClass('last'); 129 $this.next('.col4-1').addClass('third').next('.col4-1').addClass('last'); 130 } else if($this.hasClass('col3-1')) { 131 $this.next('.col3-1').addClass('second').next('.col3-1').addClass('last'); 132 $this.next('.col3-2').addClass('last'); 133 } else if($this.hasClass('col3-2')) { 134 $this.next('.col3-1').addClass('last'); 135 } else if($this.hasClass('col4-1')) { 136 $this.next('.col4-1').addClass('second').next('.col4-1').addClass('third').next('.col4-1').addClass('last'); 137 } else if($this.hasClass('col4-2')) { 138 $this.next('.col4-2').addClass('last'); 139 $this.next('.col4-1').addClass('third').next('.col4-1').addClass('last'); 140 } else if($this.hasClass('col4-3')) { 141 $this.next('.col4-1').addClass('last'); 142 } 143 }); 144 var col_nums = 1; 145 $('.col-full').each(function(){ 146 var $this = $(this); 147 $this.removeClass('first last'); 148 if( col_nums % 2 == 0) { 149 $this.addClass('last'); 150 } else { 151 $this.addClass('first'); 152 } 153 col_nums += 1; 154 }); 155 // Global Animation 156 $.each(themifyScript.transitionSetup.selectors, function(key, val){ 157 $(val).addClass(themifyScript.transitionSetup.effect); 158 }); 159 // Specific Animation 160 $.each(themifyScript.transitionSetup.specificSelectors, function(selector, effect){ 161 $(selector).addClass(effect); 162 }); 163 } 164 } 165}; 166
167// Scroll to Element ////////////////////////////// 168function themeScrollTo(offset) { 169 $('body,html').animate({ scrollTop: offset }, 800); 170} 171 172// DOCUMENT READY 173$(document).ready(function() { 174 175 var $body = $('body'), $placeholder = $('[placeholder]'), $charts = $('.chart'), $skills = $('.progress-bar'); 176 177 // Fixed header 178 if( ('' != themifyScript.fixedHeader && ! themifyScript.scrollingEffectOn) || (! is_touch_device() && '' != themifyScript.fixedHeader) ){ 179 FixedHeader.init(); 180 } 181 182 ///////////////////////////////////////////// 183 // Chart Initialization 184 ///////////////////////////////////////////// 185 if( typeof $.fn.easyPieChart !== 'undefined' ) { 186 $charts.each(function(){ 187 var $self = $(this), 188 barColor = $self.data('color'), 189 percent = $self.data('percent'); 190 $.each(themifyScript.chart, function(index, value){ 191 if( 'false' == value || 'true' == value ){ 192 themifyScript.chart[index] = 'false'!=value; 193 } else if( parseInt(value) ){ 194 themifyScript.chart[index] = parseInt(value); 195 } else if( parseFloat(value) ){ 196 themifyScript.chart[index] = parseFloat(value); 197 } 198 }); 199 if( typeof barColor !== 'undefined' ) 200 themifyScript.chart.barColor = '#' + barColor.toString().replace('#', ''); 201 $self.easyPieChart( themifyScript.chart ); 202 $self.data('easyPieChart').update(0); 203 if( typeof $.waypoints !== 'undefined' && themifyScript.scrollingEffectOn ) { 204 $self.waypoint(function(direction){ 205 $self.data('easyPieChart').update(percent); 206 }, {offset: '80%'}); 207 $self.waypoint(function(direction){ 208 if(direction === 'up') { 209 $self.data('easyPieChart').update(0); 210 } 211 }, {offset: '92%'}); 212 } else { 213 $self.data('easyPieChart').update(percent); 214 } 215 }); 216 } 217 218 ///////////////////////////////////////////// 219 // Skillset Animation 220 ///////////////////////////////////////////// 221 if( themifyScript.scrollingEffectOn ) { 222 $skills.each(function(){ 223 var $self = $(this).find('span'), 224 percent = $self.data('percent'); 225 226 $self.width(0).on('inview', function(event, isInView, visiblePartX, visiblePartY) { 227 if (isInView) { 228 if($(this).hasClass('animated')) return; 229 230 $(this).animate({width: percent}, 800,function(){ 231 $(this).addClass('animated'); 232 }); 233 } else { 234 // element has gone out of viewport 235 $(this).removeClass('animated').width(0); 236 } 237 }); 238 }); 239 } 240 241 242 ///////////////////////////////////////////// 243 // Scroll to top 244 ///////////////////////////////////////////// 245 $('.back-top a').on('click', function(e){ 246 e.preventDefault(); 247 themeScrollTo(0); 248 }); 249 250 // anchor scrollTo 251 $body.on('click', 'a[href*=#]', function(e){ 252 var url = $(this).prop('href'), 253 idx = url.indexOf('#'), 254 hash = idx != -1 ? url.substring(idx+1) : '', 255 offset = 0; 256 257 if(hash.length > 1 && $('#' + hash).length > 0 && hash !== 'header') { 258 offset = $('#' + hash).offset().top; 259 // If header is set to fixed, calculate this 260 if ( $('.fixed-header' ).length > 0 ) { 261 offset += $( '#headerwrap' ).outerHeight(); 262 } 263 264 themeScrollTo(offset); 265 e.preventDefault(); 266 } 267 268 // close mobile menu 269 if($(window).width() <= 780 && $('#main-nav').is(':visible')){ 270 $('#menu-icon').trigger('click'); 271 } 272 }); 273 274 ///////////////////////////////////////////// 275 // Toggle main nav on mobile 276 ///////////////////////////////////////////// 277 $body.on('click', '#menu-icon', function(e){ 278 e.preventDefault(); 279 $('#main-nav').fadeToggle(); 280 $('#top-nav', $('#headerwrap')).hide(); 281 $(this).toggleClass('active'); 282 }); 283 284 $body.on('touchstart touchmove touchend', '#main-nav', function(e) { 285 e.stopPropagation(); 286 }); 287 288 ///////////////////////////////////////////// 289 // Add class "first" to first elements 290 ///////////////////////////////////////////// 291 $('.highlight-post:odd').addClass('odd'); 292 293 ///////////////////////////////////////////// 294 // Lightbox / Fullscreen initialization 295 ///////////////////////////////////////////// 296 if(typeof ThemifyGallery !== 'undefined') { 297 ThemifyGallery.init({'context': $(themifyScript.lightboxContext)}); 298 } 299 300 // Transition Effect 301 if ( themifyScript.scrollingEffectOn ) { 302 ThemeTransition.init(); 303 } 304 305}); 306 307// WINDOW LOAD 308$(window).load(function() { 309 // scrolling nav 310 if ( typeof($.fn.themifySectionHighlight) !== 'undefined' && themifyScript.scrollingEffectOn ) { 311 $('body').themifySectionHighlight(); 312 } 313 314 ///////////////////////////////////////////// 315 // Carousel initialization 316 /////////////////////////////////////////////
317 if( typeof $.fn.carouFredSel !== 'undefined' ) { 318 createCarousel($('.slideshow')); 319 } 320 321}); 322 323})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.