1var $scroll = 0; 2var $window_width = $(window).width(); 3var $window_height = $(window).height(); 4var logo_height; 5var menu_dropdown_height_set = false; 6var sticky_amount = 0; 7var src; 8var next_image; 9var prev_image; 10var $top_header_height; 11 12var min_w = 1500; // minimum video width allowed 13var video_width_original = 1280; // original video dimensions 14var video_height_original = 720; 15var vid_ratio = 1280/720; 16var skrollr_slider; 17 18$(document).ready(function() { 19 "use strict"; 20 21 $('.content').css('min-height',$(window).height()-$('header.page_header').height()-$('footer').height()); 22 23 if($('body').hasClass('vertical_menu_enabled')){ 24 var min_header_height_sticky = 0; 25 } 26 27 setDropDownMenuPosition(); 28 initDropDownMenu(); 29 initVerticalMenuToggle(); 30 initVerticalMobileMenu(); 31 initSideMenu(); 32 initPopupMenu(); 33 initMessageHeight(); 34 initToCounter(); 35 initCounter(); 36 initProgressBars(); 37 initListAnimation(); 38 initPieChart(); 39 initPieChartWithIcon(); 40 initParallaxTitle(); 41 initSideAreaScroll(); 42 initVerticalAreaMenuScroll(); 43 loadMore(); 44// prettyPhoto(); 45 initMobileMenu(); 46// initFlexSlider(); 47// fitVideo(); // This one causes problems with CKEditor in IE 48 fitAudio(); 49 initAccordion(); 50 initAccordionContentLink(); 51 initMessages(); 52 initProgressBarsIcon(); 53 initMoreFacts(); 54 placeholderReplace(); 55 backButtonShowHide(); 56 backToTop(); 57 initProgressBarsVertical(); 58 initElementsAnimation(); 59 updateShoppingCart(); 60 initHashClick(); 61 initImageHover(); 62 initIconWithTextAnimation(); 63 initVideoBackground(); 64 initCheckSafariBrowser(); 65 initCheckFirefoxMacBrowser(); 66// initSearchButton(); // Interferes with Member Quick Search button 67 initCoverBoxes(); 68 initButtonHover(); 69 initSocialIconHover(); 70 71 $('.widget #searchform').mousedown(function(){$(this).addClass('form_focus');}).focusout(function(){$(this).removeClass('form_focus');}); 72 $scroll = $(window).scrollTop(); 73 checkTitleToShowOrHide(); //this has to be after setting $scroll since function uses $scroll variable 74 checkVerticalMenuTransparency(); //this has to be after setting $scroll since function uses $scroll variable 75 76 /* set header and content menu position and appearance on page load - START */ 77 if($(window).width() > 1000){ 78 headerSize($scroll); 79 }else{ 80 logoSizeOnSmallScreens(); 81 } 82 83 $('header:not(.stick_with_left_right_menu) .q_logo a').css('visibility','visible'); 84 /* set header and content menu position and appearance on page load - END */ 85 86 initFullScreenTemplate(); 87}); 88 89window.addEventListener('load', function(){ 90 "use strict"; 91 92 $('.touch .main_menu li:has(div.second)').doubleTapToGo(); // load script to close menu on touch devices 93 setDropDownMenuPosition(); 94 initDropDownMenu(); 95 initPortfolio(); 96 initPortfolioZIndex(); 97 initPortfolioSingleInfo(); 98 initTestimonials(); 99 initVideoBackgroundSize(); 100 initBlog(); 101 initBlogMasonryFullWidth(); 102 initPortfolioMasonry(); 103 initPortfolioMasonryFilter(); 104 initTabs(); 105 animatedTextIconHeight(); 106 countAnimatedTextIconPerRow(); 107 initTitleAreaAnimation(); 108 setContentBottomMargin(); 109 footerWidth(); 110 // initQodeCarousel(); // ?????????? 111 initPortfolioSlider(); 112 setFooterHeight(); 113 114 $('header.stick_with_left_right_menu .q_logo a').css('visibility','visible'); 115 116 setMargingsForLeftAndRightMenu(); 117 initImageGallerySliderNoSpace(); 118 initParallax(); //has to be here on last place since some function is interfering with parallax 119 setTimeout(function(){ 120 checkAnchorOnScroll(); 121 checkAnchorOnLoad(); // it has to be after content top margin initialization to know where to scroll 122 },700); //timeout is set because of some function that interferes with calculating 123}); 124 125$(window).scroll(function() { 126 "use strict"; 127 128 $scroll = $(window).scrollTop(); 129 130 if($(window).width() > 1000){ 131 headerSize($scroll); 132 } 133 134 checkVerticalMenuTransparency(); 135 136 $('.touch .drop_down > ul > li').mouseleave(); 137 $('.touch .drop_down > ul > li').blur(); 138}); 139 140$(window).resize(function() { 141 "use strict"; 142 143 $window_width = $(window).width(); 144 $window_height = $(window).height(); 145 146 if($(window).width() > 1000){ 147 headerSize($scroll); 148 }else{ 149 logoSizeOnSmallScreens(); 150 } 151 initMessageHeight(); 152 initTestimonials(); 153 fitAudio(); 154 initBlog(); 155 initBlogMasonryFullWidth(); 156 animatedTextIconHeight(); 157 countAnimatedTextIconPerRow();
158 initVideoBackgroundSize(); 159 setContentBottomMargin(); 160 footerWidth(); 161 setFooterHeight(); 162 calculateHeights(); 163}); 164 165/* 166 ** Calculating header size on page load and page scroll 167 */ 168var sticky_animate; 169function headerSize($scroll){ 170 "use strict"; 171 172 if(($('header.page_header').hasClass('scroll_top')) && ($('header.page_header').hasClass('has_top')) && ($('header.page_header').hasClass('fixed'))){ 173 if($scroll >= 0 && $scroll <= 33){ 174 $('header.page_header').css('top',-$scroll); 175 $('header.page_header').css('margin-top',0); 176 $('.header_top').show(); 177 }else if($scroll > 33){ 178 $('header.page_header').css('top','-33px'); 179 $('header.page_header').css('margin-top',33); 180 $('.header_top').hide(); 181 } 182 } 183 184 //is scroll amount for sticky set on page? 185 if(typeof page_scroll_amount_for_sticky !== 'undefined') { 186 sticky_amount = page_scroll_amount_for_sticky; 187 } 188 //do we have slider on the page? 189 else if($('.carousel.full_screen').length) { 190 sticky_amount = $('.carousel').height(); 191 } 192 193 //take value from theme options 194 else { 195 sticky_amount = scroll_amount_for_sticky; 196 } 197 198 if($('header').hasClass('regular')){ 199 if(header_height - logo_height > 0){ 200 $('.q_logo a').height(logo_height); 201 }else{ 202 $('.q_logo a').height(header_height); 203 } 204 205 $('.q_logo a img').css('height','100%'); 206 } 207 208 if($('header.page_header').hasClass('fixed')){ 209 if($('header.page_header').hasClass('scroll_top')){ 210 $top_header_height = 33; 211 }else{ 212 $top_header_height = 0; 213 } 214 215 if((header_height - $scroll + $top_header_height >= min_header_height_scroll) && ($scroll >= $top_header_height)){ 216 $('header.page_header').removeClass('scrolled'); 217 $('header:not(.centered_logo.centered_logo_animate) nav.main_menu > ul > li > a').css('line-height', header_height - $scroll + $top_header_height+'px'); 218 $('header:not(.centered_logo.centered_logo_animate) .side_menu_button').css('height', header_height - $scroll + $top_header_height+'px'); 219 $('header:not(.centered_logo.centered_logo_animate) .shopping_cart_inner').css('height', header_height - $scroll + $top_header_height+'px'); 220 $('header:not(.centered_logo.centered_logo_animate) .logo_wrapper').css('height', header_height - $scroll + $top_header_height +'px'); 221 if(header_height - logo_height > 0){ 222 $('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', logo_height +'px'); 223 }else{ 224 $('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', (header_height - $scroll + $top_header_height) +'px'); 225 } 226 227 }else if($scroll < $top_header_height){ 228 $('header.page_header').removeClass('scrolled'); 229 $('header:not(.centered_logo.centered_logo_animate) nav.main_menu > ul > li > a').css('line-height', header_height+'px'); 230 $('header:not(.centered_logo.centered_logo_animate) .side_menu_button').css('height', header_height+'px'); 231 $('header:not(.centered_logo.centered_logo_animate) .shopping_cart_inner').css('height', header_height+'px'); 232 $('header:not(.centered_logo.centered_logo_animate) .logo_wrapper').css('height', header_height+'px'); 233 if(header_height - logo_height > 0){ 234 $('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', logo_height +'px'); 235 }else{ 236 $('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', header_height +'px'); 237 } 238 239 }else if((header_height - $scroll + $top_header_height) < min_header_height_scroll){ 240 $('header.page_header').addClass('scrolled'); 241 $('header:not(.centered_logo.centered_logo_animate) nav.main_menu > ul > li > a').css('line-height', min_header_height_scroll+'px'); 242 $('header:not(.centered_logo.centered_logo_animate) .side_menu_button').css('height', min_header_height_scroll+'px'); 243 $('header:not(.centered_logo.centered_logo_animate) .shopping_cart_inner').css('height', min_header_height_scroll+'px'); 244 $('header:not(.centered_logo.centered_logo_animate) .logo_wrapper').css('height', min_header_height_scroll+'px'); 245 if(min_header_height_scroll - logo_height > 0){ 246 $('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', logo_height +'px'); 247 }else{ 248 $('header:not(.centered_logo.centered_logo_animate) .q_logo a').css('height', min_header_height_scroll+'px'); 249 } 250 } 251 252 // logo part - start // 253 254 if($('header.page_header').hasClass('centered_logo') && $('header.page_header').hasClass('centered_logo_animate')){ 255 if((header_height - $scroll + $top_header_height < logo_height) && (header_height - $scroll + $top_header_height >= min_header_height_scroll) && (logo_height > min_header_height_scroll) && ($scroll >
255= $top_header_height)){ 256 $('.q_logo a').height(header_height - $scroll + $top_header_height); 257 }else if((header_height - $scroll + $top_header_height < logo_height) && (header_height - $scroll + $top_header_height >= min_header_height_scroll) && (logo_height > min_header_height_scroll) && ($scroll < $top_header_height)){ 258 $('.q_logo a').height(header_height); 259 }else if((header_height - $scroll + $top_header_height < logo_height) && (header_height - $scroll + $top_header_height < min_header_height_scroll) && (logo_height > min_header_height_scroll)){ 260 $('.q_logo a').height(min_header_height_scroll); 261 }else if((header_height - $scroll + $top_header_height < logo_height) && (header_height - $scroll + $top_header_height < min_header_height_scroll) && (logo_height < min_header_height_scroll)){ 262 $('.q_logo a').height(logo_height); 263 }else if(($scroll + $top_header_height === 0) && (logo_height > header_height)){ 264 $('.q_logo a').height(logo_height); 265 }else{ 266 $('.q_logo a').height(logo_height); 267 } 268 }else if($('header.page_header').hasClass('centered_logo')) { 269 $('.q_logo a').height(logo_height); 270 $('.q_logo img').height('auto'); 271 }else{ 272 $('.q_logo img').height('100%'); 273 } 274 // logo part - end // 275 } 276 277 if($('header.page_header').hasClass('fixed_hiding')){ 278 279 if($scroll < scroll_amount_for_fixed_hiding){ 280 $('header.page_header').removeClass('scrolled'); 281 }else{ 282 $('header.page_header').addClass('scrolled'); 283 } 284 285 $('.q_logo a').height(logo_height/2); //because of retina displays 286 $('.q_logo img').height('100%'); 287 } 288 289 if($('header.page_header').hasClass('stick') || $('header.page_header').hasClass('stick_with_left_right_menu')){ 290 if($scroll > sticky_amount){ 291 if(!$('header.page_header').hasClass('sticky')){ 292 if($('header.page_header').hasClass('has_top')){ 293 $top_header_height = 33; 294 }else{ 295 $top_header_height = 0; 296 } 297 var padding_top = $('header.page_header').hasClass('centered_logo') ? $('header.page_header').height() : header_height + $top_header_height; 298 if($('header.page_header').hasClass('menu_bottom')){ 299 padding_top = header_height + 60; //60 is menu height for Sticky Advance header type 300 } 301 $('header.page_header').addClass('sticky'); 302 $('.content').css('padding-top',padding_top); 303 304 window.clearTimeout(sticky_animate); 305 sticky_animate = window.setTimeout(function(){$('header.page_header').addClass('sticky_animate');},100); 306 307 if(min_header_height_sticky - logo_height > 0){ 308 $('.q_logo a').height(logo_height); 309 }else{ 310 $('.q_logo a').height(min_header_height_sticky); 311 } 312 313 if($('header.page_header').hasClass('menu_bottom')){ 314 initDropDownMenu(); //recalculate dropdown menu position 315 } 316 } 317 318 if(min_header_height_sticky - logo_height > 0){ 319 $('.q_logo a').height(logo_height); 320 }else{ 321 $('.q_logo a').height(min_header_height_sticky); 322 } 323 // logo part - end // 324 }else{ 325 if($('header.page_header').hasClass('sticky')){ 326 $('header').removeClass('sticky_animate'); 327 $('header').removeClass('sticky'); 328 $('.content').css('padding-top','0px'); 329 330 if($('header.page_header').hasClass('menu_bottom')){ 331 initDropDownMenu(); //recalculate dropdown menu position 332 } 333 } 334 335 setMargingsForLeftAndRightMenu(); 336 337 // logo part - start // 338 if(!$('header.page_header').hasClass('centered_logo')){ 339 if(header_height - logo_height > 0){ 340 $('.q_logo a').height(logo_height); 341 }else{ 342 $('.q_logo a').height(header_height); 343 } 344 }else{ 345 $('.q_logo a').height(logo_height); 346 $('.q_logo img').height('auto'); 347 } 348 $('.q_logo a img').css('height','100%'); 349 // logo part - end // 350 } 351 } 352} 353 354function setMargingsForLeftAndRightMenu(){ 355 "use strict"; 356
357 if($('header.page_header').hasClass('stick_with_left_right_menu') && !$('header.page_header').hasClass('left_right_margin_set')){ 358 var logo_width = $('.q_logo a img').width()/2; 359 if($scroll === 0 && logo_width !== 0){ 360 $('header.page_header').addClass('left_right_margin_set'); 361 } 362 $('.logo_wrapper').width(logo_width*2); 363 $('nav.main_menu.left_side > ul > li:last-child').css('margin-right',logo_width); 364 $('nav.main_menu.right_side > ul > li:first-child').css('margin-left',logo_width); 365 } 366} 367 368/* 369** Calculating logo size on smaller screens 370*/ 371function logoSizeOnSmallScreens(){ 372 "use strict"; 373 374 if(100 - logo_height > 0){ 375 $('.q_logo a').height(logo_height); 376 }else{ 377 $('.q_logo a').height(100); 378 } 379 380 $('.q_logo a img').css('height','100%'); 381 382 $('header.page_header').removeClass('sticky_animate sticky'); 383 $('.content').css('padding-top','0px'); 384} 385 386/* 387** Initialize Qode Slider 388*/ 389var default_header_style; 390function initQodeSlider(){ 391 "use strict"; 392 393 var image_regex = /url\(["']?([^'")]+)['"]?\)/; 394 default_header_style = ""; 395 if($('header.page_header').hasClass('light')){ default_header_style = 'light';} 396 if($('header.page_header').hasClass('dark')){ default_header_style = 'dark';} 397 398 if($('.carousel').length){ 399 $('.carousel').each(function(){ 400 var $this = $(this); 401 var mobile_header; 402 403 if($this.hasClass('full_screen')){ 404 405 mobile_header = $(window).width() < 1000 ? $('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block 406 $this.css({'height': ($(window).height() - mobile_header) + 'px'}); 407 $this.find('.qode_slider_preloader').css({'height': ($(window).height() - mobile_header) + 'px'}); 408 $this.find('.qode_slider_preloader .ajax_loader').css({'display': 'block'}); 409 $this.find('.item').css({'height': ($(window).height() - mobile_header) + 'px'}); 410 $(window).resize(function() { 411 var mobile_header = $(window).width() < 1000 ? $('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block 412 $this.css({'height': ($(window).height() - mobile_header) + 'px'}); 413 $this.find('.item').css({'height': ($(window).height() - mobile_header) + 'px'}); 414 }); 415 }else if($this.hasClass('responsive_height')){ 416 mobile_header = $(window).width() < 1000 ? $('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block 417 var $def_height = $this.data('height'); 418 419 $this.find('.qode_slider_preloader').css({'height': ($this.height() - mobile_header) + 'px', 'display': 'block'}); 420 var slider_height = $def_height; 421 if($window_width > 1600){ 422 var slider_height = $def_height; 423 }else if($window_width <= 1600 && $window_width > 1300){ 424 var slider_height = $def_height * 0.8; 425 }else if($window_width <= 1300 && $window_width > 1000){ 426 var slider_height = $def_height * 0.8; 427 }else if($window_width <= 1000 && $window_width > 768){ 428 var slider_height = $def_height * 0.55; 429 }else if($window_width <= 768){ 430 var slider_height = $def_height * 1; 431 } 432 433 $this.css({'height': (slider_height) + 'px'}); 434 $this.find('.qode_slider_preloader').css({'height': (slider_height) + 'px'}); 435 $this.find('.qode_slider_preloader .ajax_loader').css({'display': 'block'}); 436 $this.find('.item').css({'height': (slider_height) + 'px'}); 437 438 $(window).resize(function() { 439 440 if($window_width > 1600){ 441 var slider_height = $def_height; 442 }else if($window_width <= 1600 && $window_width > 1300){ 443 var slider_height = $def_height * 0.8; 444 }else if($window_width <= 1300 && $window_width > 1000){ 445 var slider_height = $def_height * 0.8; 446 }else if($window_width <= 1000 && $window_width > 768){ 447 var slider_height = $def_height * 0.55; 448 }else if($window_width <= 768){ 449 var slider_height = $def_height * 1; 450 } 451
452 $this.css({'height': (slider_height) + 'px'}); 453 $this.find('.item').css({'height': (slider_height) + 'px'}); 454 }); 455 }else { 456 mobile_header = $(window).width() < 1000 ? $('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block 457 $this.find('.qode_slider_preloader').css({'height': ($this.height() - mobile_header) + 'px', 'display': 'block'}); 458 $this.find('.qode_slider_preloader .ajax_loader').css({'display': 'block'}); 459 } 460 461 if($('body:not(.boxed):not(.vertical_menu_transparency)').hasClass('vertical_menu_enabled') && $(window).width() > 1000){ 462 $this.find('.carousel-inner').width($window_width - 260); 463 $(window).resize(function() { 464 if($(window).width() > 1000){ 465 $this.find('.carousel-inner').width($window_width - 260); 466 } else { 467 $this.find('.carousel-inner').css('width','100%'); 468 } 469 }); 470 } 471 472 $(window).scroll(function() { 473 if($scroll > $(window).height() && $(window).width() > 1000){ 474 $this.find('.carousel-inner, .carousel-indicators, button').hide(); 475 }else{ 476 $this.find('.carousel-inner, .carousel-indicators, button').show(); 477 } 478 }); 479 480 var $slide_animation = $this.data('slide_animation'); 481 if($slide_animation === ""){ 482 $slide_animation = 6000; 483 } 484 485 // function for setting prev/next numbers on arrows 486 var all_items_count = $('div.item').length; 487 function setPrevNextNumbers(curr_item, all_items_count){ 488 if(curr_item == 1){ 489 $this.find('.left.carousel-control .prev').html(all_items_count); 490 $this.find('.right.carousel-control .next').html(curr_item + 1); 491 }else if(curr_item == all_items_count){ 492 $this.find('.left.carousel-control .prev').html(curr_item - 1); 493 $this.find('.right.carousel-control .next').html(1); 494 }else{ 495 $this.find('.left.carousel-control .prev').html(curr_item - 1); 496 $this.find('.right.carousel-control .next').html(curr_item + 1); 497 } 498 } 499 500 function initSlider(){ 501 //set active class on first item 502 $this.find('.carousel-inner .item:first-child').addClass('active'); 503 checkSliderForHeaderStyle($('.carousel .active'), $this.hasClass('header_effect')); 504 505 if($this.hasClass('slider_thumbs')){ 506 // initial state of prev/next numbers 507 setPrevNextNumbers(1, all_items_count); 508 509 //set prev and next thumb on load 510 if($this.find('.active').next('div').find('.image').length){ 511 src = image_regex.exec($this.find('.active').next('div').find('.image').attr('style')); 512 next_image = new Image(); 513 next_image.src = src[1]; 514 }else{ 515 next_image = $this.find('.active').next('div').find('> .video').clone(); 516 next_image.find('.video-overlay').remove(); 517 next_image.find('.video-wrap').width(170).height(95); 518 next_image.find('.mejs-container').width(170).height(95); 519 next_image.find('video').width(170).height(95); 520 } 521 $this.find('.right.carousel-control .img').html(next_image).find('img, div.video').addClass('old'); 522 523 if($this.find('.carousel-inner .item:last-child .image').length){ 524 src = image_regex.exec($this.find('.carousel-inner .item:last-child .image').attr('style')); 525 prev_image = new Image(); 526 prev_image.src = src[1]; 527 }else{ 528 prev_image = $this.find('.carousel-inner .item:last-child > .video').clone(); 529 prev_image.find('.video-overlay').remove(); 530 prev_image.find('.video-wrap').width(170).height(95); 531 prev_image.find('.mejs-container').width(170).height(95); 532 prev_image.find('video').width(170).height(95); 533 } 534 $this.find('.left.carousel-control .img').html(prev_image).find('img, div.video').addClass('old'); 535 } 536 537 if($this.hasClass('q_auto_start')){ 538 $this.carousel({ 539 interval: $slide_animation, 540 pause: false 541 }); 542 } else { 543 $this.carousel({ 544 interval: 0, 545 pause: false 546 }); 547 } 548 if($this.find('.item video').length){
549 initVideoBackgroundSize(); 550 } 551 } 552 553 if($('html').hasClass('touch')){ 554 if($this.find('.item:first-child .mobile-video-image').length > 0){ 555 src = image_regex.exec($this.find('.item:first-child .mobile-video-image').attr('style')); 556 if (src) { 557 var backImg = new Image(); 558 backImg.src = src[1]; 559 backImg.addEventListener('load', function(){ 560 $('.qode_slider_preloader').fadeOut(500); 561 initSlider(); 562 }); 563 } 564 } 565 else{ 566 src = image_regex.exec($this.find('.item:first-child .image').attr('style')); 567 if (src) { 568 var backImg = new Image(); 569 backImg.src = src[1]; 570 backImg.addEventListener('load', function(){ 571 $('.qode_slider_preloader').fadeOut(500); 572 initSlider(); 573 }); 574 } 575 } 576 } else { 577 if($this.find('.item:first-child video').length > 0){ 578 $this.find('.item:first-child video').get(0).addEventListener('loadeddata',function(){ 579 $('.qode_slider_preloader').fadeOut(500); 580 initSlider(); 581 }); 582 }else{ 583 src = image_regex.exec($this.find('.item:first-child .image').attr('style')); 584 if (src) { 585 var backImg = new Image(); 586 backImg.src = src[1]; 587 backImg.addEventListener('load', function(){ 588 $('.qode_slider_preloader').fadeOut(500); 589 initSlider(); 590 }); 591 } 592 } 593 } 594 595 $this.on('slide.bs.carousel', function () { 596 $this.addClass('in_progress'); 597 $this.find('.active .slider_content_outer').fadeTo(800,0); 598 }); 599 $this.on('slid.bs.carousel', function () { 600 $this.removeClass('in_progress'); 601 $this.find('.active .slider_content_outer').fadeTo(0,1); 602 603 if($this.hasClass('slider_thumbs')){ 604 var curr_item = $('div.item').index($('div.item.active')[0]) + 1; 605 setPrevNextNumbers(curr_item, all_items_count); 606 607 // prev thumb 608 if($this.find('.active').prev('div.item').length){ 609 if($this.find('.active').prev('div').find('.image').length){ 610 src = image_regex.exec($this.find('.active').prev('div').find('.image').attr('style')); 611 prev_image = new Image(); 612 prev_image.src = src[1]; 613 }else{ 614 prev_image = $this.find('.active').prev('div').find('> .video').clone(); 615 prev_image.find('.video-overlay').remove(); 616 prev_image.find('.video-wrap').width(170).height(95); 617 prev_image.find('.mejs-container').width(170).height(95); 618 prev_image.find('video').width(170).height(95); 619 } 620 $this.find('.left.carousel-control .img .old').fadeOut(300,function(){ 621 $(this).remove(); 622 }); 623 $this.find('.left.carousel-control .img').append(prev_image).find('img, div.video').fadeIn(300).addClass('old'); 624 625 }else{ 626 if($this.find('.carousel-inner .item:last-child .image').length){ 627 src = image_regex.exec($this.find('.carousel-inner .item:last-child .image').attr('style')); 628 prev_image = new Image(); 629 prev_image.src = src[1]; 630 }else{ 631 prev_image = $this.find('.carousel-inner .item:last-child > .video').clone(); 632 prev_image.find('.video-overlay').remove(); 633 prev_image.find('.video-wrap').width(170).height(95); 634 prev_image.find('.mejs-container').width(170).height(95); 635 prev_image.find('video').width(170).height(95); 636 } 637 $this.find('.left.carousel-control .img .old').fadeOut(300,function(){ 638 $(this).remove(); 639 }); 640 $this.find('.left.carousel-control .img').append(prev_image).find('img, div.video').fadeIn(300).addClass('old'); 641 } 642 643 // next thumb 644 if($this.find('.active').next('div.item').length){ 645 if($this.find('.active').next('div').find('.image').length){ 646 src = image_regex.exec($this.find('.active').next('div').find('.image').attr('style')); 647 next_image = new Image(); 648 next_image.src = src[1]; 649 }else{ 650 next_image = $this.find('.active').next('div').find('> .video').clone(); 651 next_image.find('.video-overlay').remove(); 652 next_image.find('.video-wrap').width(170).height(95); 653 next_image.find('.mejs-container').width(170).height(95); 654 next_image.find('video').width(170).height(95); 655 } 656 657 $this.find('.right.carousel-control .img .old').fadeOut(300,function(){ 658 $(this).remove(); 659 });
660 $this.find('.right.carousel-control .img').append(next_image).find('img, div.video').fadeIn(300).addClass('old'); 661 662 }else{ 663 if($this.find('.carousel-inner .item:first-child .image').length){ 664 src = image_regex.exec($this.find('.carousel-inner .item:first-child .image').attr('style')); 665 next_image = new Image(); 666 next_image.src = src[1]; 667 }else{ 668 next_image = $this.find('.carousel-inner .item:first-child > .video').clone(); 669 next_image.find('.video-overlay').remove(); 670 next_image.find('.video-wrap').width(170).height(95); 671 next_image.find('.mejs-container').width(170).height(95); 672 next_image.find('video').width(170).height(95); 673 } 674 $this.find('.right.carousel-control .img .old').fadeOut(300,function(){ 675 $(this).remove(); 676 }); 677 $this.find('.right.carousel-control .img').append(next_image).find('img, div.video').fadeIn(300).addClass('old'); 678 } 679 } 680 }); 681 682 $this.swipe( { 683 swipeLeft: function(event, direction, distance, duration, fingerCount){ $this.carousel('next'); }, 684 swipeRight: function(event, direction, distance, duration, fingerCount){ $this.carousel('prev'); }, 685 threshold:20 686 }); 687 688 }); 689 690 if($('.carousel').data('parallax') == 'yes'){ 691 if ($('.no-touch .carousel').length) { 692 skrollr_slider = skrollr.init({ 693 edgeStrategy: 'set', 694 smoothScrolling: true, 695 forceHeight: false 696 }); 697 skrollr_slider.refresh(); 698 } 699 } 700 } 701} 702 703function checkSliderForHeaderStyle($this, header_effect){ 704 "use strict"; 705 706 var slide_header_style = ""; 707 if($this.hasClass('light')){ slide_header_style = 'light';} 708 if($this.hasClass('dark')){ slide_header_style = 'dark';} 709 710 if( slide_header_style !== ""){ 711 if(header_effect){ 712 $('header.page_header').removeClass('dark light').addClass(slide_header_style); 713 $('aside.vertical_menu_area').removeClass('dark light').addClass(slide_header_style); 714 } 715 $('.carousel .carousel-control, .carousel .carousel-indicators').removeClass('dark light').addClass(slide_header_style); 716 }else{ 717 if(header_effect) { 718 if(default_header_style !== '') { 719 $('header.page_header').removeClass('dark light').addClass(default_header_style); 720 $('aside.vertical_menu_area').removeClass('dark light').addClass(default_header_style); 721 } 722 } 723 $('.carousel .carousel-control, .carousel .carousel-indicators').removeClass('dark light').addClass(default_header_style); 724 } 725} 726 727/* 728 ** Set heights for qode carousel and portfolio slider 729 */ 730function calculateHeights(){ 731 if($('.portfolio_slides').length){ 732 $('.portfolio_slides').each(function(){ 733 $(this).parents('.caroufredsel_wrapper').css({'height' : ($(this).find('li.item').outerHeight()-3) + 'px'}); //3 is because of the white line bellow the slider 734 }); 735 } 736 737 if($('.qode_carousels .slides').length){ 738 $('.qode_carousels .slides').each(function(){ 739 $(this).parents('.caroufredsel_wrapper').css({'height' : ($(this).find('li.item').outerHeight()) + 'px'}); 740 }); 741 } 742} 743 744/* 745** Init Portfolio Slider 746*/ 747function initPortfolioSlider(){ 748 "use strict"; 749 750 if($('.portfolio_slider').length){ 751 752 $('.portfolio_slider').each(function(){ 753 var maxItems = ($(this).parents('.grid_section').length == 1) ? 3 : 'auto'; 754 var itemWidth = ($(this).parents('.grid_section').length == 1) ? 353 : 500; 755 756 $('.portfolio_slides').carouFredSel({ 757 circular: true, 758 responsive: true, 759 scroll: 1, 760 prev : { 761 button : function() { 762 return $(this).parent().siblings('.caroufredsel-direction-nav').find('#caroufredsel-prev'); 763 } 764 }, 765 next : { 766 button : function() { 767 return $(this).parent().siblings('.caroufredsel-direction-nav').find('#caroufredsel-next'); 768 } 769 }, 770 items: { 771 width: itemWidth, 772 visible: { 773 min: 1, 774 max: maxItems 775 } 776 },
777 auto: false, 778 mousewheel: true, 779 swipe: { 780 onMouse: true, 781 onTouch: true 782 } 783 }).animate({'opacity': 1},1000); 784 }); 785 786 calculateHeights(); 787 788 $('.portfolio_slider .flex-direction-nav a').click(function(e){ 789 e.preventDefault(); 790 e.stopImmediatePropagation(); 791 e.stopPropagation(); 792 }); 793 } 794} 795 796/* 797** Opening side menu on "menu button" click 798*/ 799var current_scroll; 800function initSideMenu(){ 801 "use strict"; 802 803 $('.side_menu_button_wrapper a.side_menu_button_link, a.close_side_menu').click(function(e){ 804 e.preventDefault(); 805 $('.side_menu').css({'right':'0'}); 806 if(!$('.side_menu_button_wrapper a.side_menu_button_link').hasClass('opened')){ 807 $('.side_menu').css({'visibility':'visible'}); 808 $(this).addClass('opened'); 809 $('body').addClass('right_side_menu_opened'); 810 current_scroll = $(window).scrollTop(); 811 812 $(window).scroll(function() { 813 if(Math.abs($scroll - current_scroll) > 400){ 814 $('body').removeClass('right_side_menu_opened'); 815 $('.side_menu_button_wrapper a').removeClass('opened'); 816 var hide_side_menu = setTimeout(function(){ 817 $('.side_menu').css({'visibility':'hidden'}); 818 clearTimeout(hide_side_menu); 819 },400); 820 } 821 }); 822 }else{ 823 $('.side_menu_button_wrapper a.side_menu_button_link').removeClass('opened'); 824 $('body').removeClass('right_side_menu_opened'); 825 var hide_side_menu = setTimeout(function(){ 826 $('.side_menu').css({'visibility':'hidden'}); 827 clearTimeout(hide_side_menu); 828 },400); 829 } 830 }); 831} 832 833function setDropDownMenuPosition(){ 834 "use strict"; 835 836 var menu_items = $(".drop_down > ul > li.narrow"); 837 menu_items.each( function(i) { 838 839 var browser_width = $(window).width()-16; // 16 is width of scroll bar 840 var boxed_layout = 1150; // boxed layout width 841 var menu_item_position = $(menu_items[i]).offset().left; 842 var sub_menu_width = $(menu_items[i]).find('.second .inner ul').width(); 843 var menu_item_from_left = 0; 844 if($('body').hasClass('boxed')){ 845 menu_item_from_left = boxed_layout - (menu_item_position - (browser_width - boxed_layout)/2) + 24; // 24 is right padding between menu elements 846 } else { 847 menu_item_from_left = browser_width - menu_item_position + 24; // 24 is right padding between menu elements 848 } 849 850 var sub_menu_from_left; 851 852 if($(menu_items[i]).find('li.sub').length > 0){ 853 sub_menu_from_left = menu_item_from_left - sub_menu_width; 854 } 855 856 if(menu_item_from_left < sub_menu_width || sub_menu_from_left < sub_menu_width){ 857 $(menu_items[i]).find('.second').addClass('right'); 858 $(menu_items[i]).find('.second .inner ul').addClass('right'); 859 } 860 }); 861} 862 863function initDropDownMenu(){ 864 "use strict"; 865 866 var menu_items = $('.drop_down > ul > li'); 867 868 menu_items.each( function(i) { 869 if ($(menu_items[i]).find('.second').length > 0) { 870 if($(menu_items[i]).hasClass('wide')){ 871 var dropdown = $(this).find('.inner > ul'); 872 var dropdownPadding = parseInt(dropdown.css('padding-left').slice(0, -2)) + parseInt(dropdown.css('padding-right').slice(0, -2)); 873 874 if(!$(this).hasClass('left_position') && !$(this).hasClass('right_position')){ 875 $(this).find('.second').css('left',0); 876 } 877 878 var tallest = 0; 879 $(this).find('.second > .inner > ul > li').each(function() { 880 var thisHeight = $(this).height(); 881 if(thisHeight > tallest) { 882 tallest = thisHeight; 883 } 884 }); 885 886 $(this).find('.second > .inner > ul > li').height(tallest); 887 888 var row_number; 889 if($(this).find('.second > .inner > ul > li').length > 4){ 890 row_number = 4; 891 }else{ 892 row_number = $(this).find('.second > .inner > ul > li').length; 893 } 894 895 var width = row_number*($(this).find('.second > .inner > ul > li').outerWidth()); 896 $(this).find('.second > .inner > ul').width(width); 897 898 if(!$(this).hasClass('left_position') && !$(this).hasClass('right_position')){ 899 var left_position = ($(window).width() - 2 * ($(window).width()-$(this).find('.second').offset().left))/2 + (width+dropdownPadding)/2; 900 $(this).find('.second').css('left',-left_position); 901 } 902 } 903 904 if(!menu_dropdown_height_set){ 905 $(menu_items[i]).data('original_height', $(menu_items[i]).find('.second').height() + 'px'); 906 $(menu_items[i]).find('.second').height(0); 907 } 908 909 if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { 910 $(menu_items[i]).on("touchstart mouseenter",function(){ 911 $(menu_items[i]).find('.second').css({'height': $(menu_items[i]).data('original_height'), 'overflow': 'visible', 'visibility': 'visible', 'opacity': '1'}); 912 }).on("mouseleave", function(){ 913 $(menu_items[i]).find('.second').css({'height': '0px','overflow': 'hidden', 'visivility': 'hidden', 'opacity': '0'}); 914 }); 915 916 }else{ 917 var config = { 918 interval: 0, 919 over: function(){ 920 setTimeout(function() { 921 $(menu_items[i]).find('.second').addClass('drop_down_start'); 922 $(menu_items[i]).find('.second').stop().css({'height': $(menu_items[i]).data('original_height')}); 923 }, 150); 924 }, 925 timeout: 150, 926 out: function(){ 927 $(menu_items[i]).find('.second').stop().css({'height': '0px'}); 928 $(menu_items[i]).find('.second').removeClass('drop_down_start'); 929 } 930 }; 931 $(menu_items[i]).hoverIntent(config); 932 } 933 } 934 }); 935 $('.drop_down ul li.wide ul li a').on('click',function(){ 936 var $this = $(this); 937 setTimeout(function() { 938 $this.mouseleave(); 939 }, 500); 940 941 }); 942 943 menu_dropdown_height_set = true; 944} 945 946/* 947 ** Vertical menu toggle dropdown 948 */ 949function initVerticalMenuToggle(){ 950 "use strict"; 951 952 if($('.no-touch .vertical_menu').hasClass('vm_click_event')){ 953 //show dropdown on menu item click, no link available on menu item click if it has dropdown 954 955 var menu_items = $('.no-touch .vertical_menu_toggle > ul > li > a'); 956 var menu_items_2 = $('.no-touch .vertical_menu_toggle ul li ul li a'); 957 958 menu_items.each( function(i) { 959 if($(menu_items[i]).parent().hasClass('has_sub')){ 960 var subitems_number = $(menu_items[i]).find('.inner > ul > li').length; 961 962 $(menu_items[i]).on('click',function(e) { 963 e.preventDefault(); 964 if(!$(this).parent().hasClass('open') && !$(this).parent().hasClass('current-menu-ancestor')) { 965 966 $('.no-touch .vertical_menu_toggle > ul > li').removeClass('open current-menu-ancestor'); 967 $('.no-touch .vertical_menu_toggle > ul >
967 li').find('.second').slideUp('fast'); 968 969 $(this).parent().addClass('open'); 970 $(this).parent().find('.second').slideDown('slow', function () { 971 $('.vertical_menu_area.with_scroll').getNiceScroll().resize(); 972 }); 973 }else{ 974 $(this).parent().removeClass('open'); 975 $(this).parent().find('.second').slideUp('fast', function () { 976 $(this).parent().removeClass('current-menu-ancestor'); 977 $('.vertical_menu_area.with_scroll').getNiceScroll().resize(); 978 }); 979 } 980 return false; 981 }); 982 } 983 }); 984 985 menu_items_2.each( function(i) { 986 if($(menu_items_2[i]).parent().hasClass('menu-item-has-children')){ 987 var subitems_number = $(menu_items_2[i]).find('ul > li').length; 988 $(menu_items_2[i]).on('click',function(e) { 989 e.preventDefault(); 990 if(!$(this).parent().hasClass('open') && !$(this).parent().hasClass('current_page_parent')) { 991 $('.no-touch .vertical_menu_toggle ul li ul li').removeClass('open current_page_parent'); 992 $('.no-touch .vertical_menu_toggle ul li ul li').find('ul').slideUp('fast'); 993 994 $(this).parent().addClass('open'); 995 $(this).parent().find('ul').slideDown('slow', function () { 996 $('.vertical_menu_area.with_scroll').getNiceScroll().resize(); 997 }); 998 }else{ 999 $(this).parent().removeClass('open'); 1000 $(this).parent().find('ul').slideUp('fast', function () { 1001 $(this).parent().removeClass('current_page_parent'); 1002 $('.vertical_menu_area.with_scroll').getNiceScroll().resize(); 1003 }); 1004 } 1005 return false; 1006 }); 1007 } 1008 }); 1009 } else { 1010 var menu_items = $('.no-touch .vertical_menu_toggle > ul > li'); 1011 var menu_items_2 = $('.no-touch .vertical_menu_toggle ul li ul li'); 1012 1013 menu_items.each( function(i) { 1014 if($(menu_items[i]).hasClass('has_sub')){ 1015 var subitems_number = $(menu_items[i]).find('.inner > ul > li').length; 1016 $(menu_items[i]).hoverIntent({ 1017 over: function() { 1018 $(menu_items[i]).addClass('open'); 1019 $(menu_items[i]).find('.second').slideDown(subitems_number*40, 'easeInOutSine', function(){ 1020 $('.vertical_menu_area.with_scroll').getNiceScroll().resize(); 1021 }); 1022 1023 }, 1024 out: function() { 1025 //if(!$(menu_items[i]).hasClass('active')){ 1026 $(menu_items[i]).removeClass('open'); 1027 $(menu_items[i]).find('.second').slideUp(subitems_number*40, 'easeInOutSine'); 1028 //} 1029 }, 1030 timeout: 1000 1031 }); 1032 } 1033 }); 1034 1035 menu_items_2.each( function(i) { 1036 if($(menu_items_2[i]).hasClass('menu-item-has-children')){ 1037 var subitems_number = $(menu_items_2[i]).find('ul > li').length; 1038 $(menu_items_2[i]).hoverIntent({ 1039 over: function() { 1040 $(menu_items_2[i]).addClass('open'); 1041 $(menu_items_2[i]).find('ul').slideDown(subitems_number*40, 'easeInOutSine', function(){ 1042 $('.vertical_menu_area.with_scroll').getNiceScroll().resize(); 1043 }); 1044 }, 1045 out: function() { 1046 $(menu_items_2[i]).removeClass('open'); 1047 $(menu_items_2[i]).find('ul').slideUp(subitems_number*40, 'easeInOutSine'); 1048 }, 1049 timeout: 1000 1050 }); 1051 } 1052 }); 1053 } 1054} 1055 1056/* 1057 ** Show/Hide Vertical menu for mobile 1058 */ 1059function initVerticalMobileMenu(){ 1060 "use strict"; 1061 1062 //register tap / click event for main menu item plus icon 1063 $('.touch .vertical_menu_toggle > ul > li.has_sub > a').on('tap click', function(e){ 1064 //first prevent event propagation and it's default behavior 1065 e.stopPropagation(); 1066 e.preventDefault(); 1067 1068 //is dropdown for clicked item visible? 1069 if($(this).next('div.second').is(":visible")){ 1070 //if it is remove 'open' class and slide it up 1071 $(this).parents('.touch .vertical_menu_toggle > ul > li.has_sub').removeClass('open');
1072 $(this).next('div.second').slideUp(200); 1073 } else { 1074 //if it's not visible add 'open' class and slide it down 1075 $(this).parents('.touch .vertical_menu_toggle > ul > li.has_sub').addClass('open'); 1076 $(this).next('div.second').slideDown(200); 1077 } 1078 }); 1079 1080 //register tap / click event for second level main menu item plus icon 1081 $('.touch .vertical_menu_toggle ul li ul li.sub > a').on('tap click', function(e){ 1082 //first prevent event propagation and it's default behavior 1083 e.stopPropagation(); 1084 e.preventDefault(); 1085 1086 //is dropdown for clicked item visible? 1087 if($(this).next('ul').is(":visible")){ 1088 //if it is remove 'open' class and slide it up 1089 $(this).parents('.touch .vertical_menu_toggle ul li ul li').removeClass('open'); 1090 $(this).next('ul').slideUp(200); 1091 } else { 1092 //if it's not visible add 'open' class and slide it down 1093 $(this).parents('.touch .vertical_menu_toggle ul li ul li').addClass('open'); 1094 $(this).next('ul').slideDown(200); 1095 } 1096 }); 1097} 1098 1099/* 1100 ** Set transparency for left menu area 1101 */ 1102function checkVerticalMenuTransparency(){ 1103 "use strict"; 1104 1105 if($scroll !== 0){ 1106 $('body.vertical_menu_transparency').removeClass('vertical_menu_transparency_on'); 1107 $('body.vertical_menu_transparency').addClass('vertical_menu_transparency_off'); 1108 }else{ 1109 $('body.vertical_menu_transparency').addClass('vertical_menu_transparency_on'); 1110 $('body.vertical_menu_transparency').removeClass('vertical_menu_transparency_off'); 1111 } 1112} 1113 1114/* 1115** Plugin for counter shortcode 1116*/ 1117(function($) { 1118 "use strict"; 1119 1120 $.fn.countTo = function(options) { 1121 // merge the default plugin settings with the custom options 1122 options = $.extend({}, $.fn.countTo.defaults, options || {}); 1123 1124 // how many times to update the value, and how much to increment the value on each update 1125 var loops = Math.ceil(options.speed / options.refreshInterval), 1126 increment = (options.to - options.from) / loops; 1127 1128 return $(this).each(function() { 1129 var _this = this, 1130 loopCount = 0, 1131 value = options.from, 1132 interval = setInterval(updateTimer, options.refreshInterval); 1133 1134 function updateTimer() { 1135 value += increment; 1136 loopCount++; 1137 $(_this).html(value.toFixed(options.decimals)); 1138 1139 if (typeof(options.onUpdate) === 'function') { 1140 options.onUpdate.call(_this, value); 1141 } 1142 1143 if (loopCount >= loops) { 1144 clearInterval(interval); 1145 value = options.to; 1146 1147 if (typeof(options.onComplete) === 'function') { 1148 options.onComplete.call(_this, value); 1149 } 1150 } 1151 } 1152 }); 1153 }; 1154 1155 $.fn.countTo.defaults = { 1156 from: 0, // the number the element should start at 1157 to: 100, // the number the element should end at 1158 speed: 1000, // how long it should take to count between the target numbers 1159 refreshInterval: 100, // how often the element should be updated 1160 decimals: 0, // the number of decimal places to show 1161 onUpdate: null, // callback method for every time the element is updated, 1162 onComplete: null // callback method for when the element finishes updating 1163 }; 1164})(jQuery); 1165 1166/* 1167** Counter from zero to defined number 1168*/ 1169function initToCounter(){ 1170 "use strict"; 1171 1172 if($('.counter.zero').length){ 1173 $('.counter.zero').each(function() { 1174 if(!$(this).hasClass('executed')){ 1175 $(this).addClass('executed'); 1176 $(this).appear(function() { 1177 $(this).parent().css('opacity', '1'); 1178 var $max = parseFloat($(this).text()); 1179 $(this).countTo({ 1180 from: 0, 1181 to: $max, 1182 speed: 1500, 1183 refreshInterval: 100 1184 }); 1185 },{accX: 0, accY: -150}); 1186 } 1187 }); 1188 } 1189} 1190 1191/* 1192** Counter with random effect 1193*/ 1194function initCounter(){ 1195 "use strict"; 1196 1197 if($('.counter.random').length){ 1198 $('.counter.random').each(function() { 1199 if(!$(this).hasClass('executed')){ 1200 $(this).addClass('executed'); 1201 $(this).appear(function() { 1202 $(this).parent().css('opacity', '1'); 1203 $(this).absoluteCounter({ 1204 speed: 2000, 1205 fadeInDelay: 1000 1206 }); 1207 },{accX: 0, accY: -150}); 1208 } 1209 }); 1210 } 1211} 1212 1213/* 1214** Horizontal progress bars shortcode 1215*/ 1216function initProgressBars(){ 1217 "use strict"; 1218 1219 if($('.q_progress_bar').length){ 1220 $('.q_progress_bar').each(function() { 1221 $(this).appear(function() { 1222 initToCounterHorizontalProgressBar($(this)); 1223 var percentage = $(this).find('.progress_content').data('percentage'); 1224 $(this).find('.progress_content').css('width', '0%'); 1225 $(this).find('.progress_content').animate({'width': percentage+'%'}, 1500); 1226 $(this).find('.progress_number_wrapper').css('width', '0%'); 1227 $(this).find('.progress_number_wrapper').animate({'width': percentage+'%'}, 1500); 1228 1229 1230 }
1230,{accX: 0, accY: -150}); 1231 }); 1232 } 1233} 1234 1235/* 1236** Counter for horizontal progress bars percent from zero to defined percent 1237*/ 1238function initToCounterHorizontalProgressBar($this){ 1239 "use strict"; 1240 1241 var percentage = parseFloat($this.find('.progress_content').data('percentage')); 1242 if($this.find('.progress_number span').length) { 1243 $this.find('.progress_number span').each(function() { 1244 $(this).parents('.progress_number_wrapper').css('opacity', '1'); 1245 $(this).countTo({ 1246 from: 0, 1247 to: percentage, 1248 speed: 1500, 1249 refreshInterval: 50 1250 }); 1251 }); 1252 } 1253} 1254 1255/* 1256** Unordered list animation effect 1257*/ 1258function initListAnimation(){ 1259 "use strict"; 1260 1261 if($('.animate_list').length > 0 && $('.no_animation_on_touch').length === 0){ 1262 $('.animate_list').each(function(){ 1263 $(this).appear(function() { 1264 $(this).find("li").each(function (l) { 1265 var k = $(this); 1266 setTimeout(function () { 1267 k.animate({ 1268 opacity: 1, 1269 top: 0 1270 }, 1500); 1271 }, 100*l); 1272 }); 1273 },{accX: 0, accY: -150}); 1274 }); 1275 } 1276} 1277 1278/* 1279** Pie Chart shortcode 1280*/ 1281function initPieChart(){ 1282 "use strict"; 1283 1284 if($('.q_percentage').length){ 1285 $('.q_percentage').each(function() { 1286 1287 var $barColor = piechartcolor; 1288 1289 if($(this).data('active') !== ""){ 1290 $barColor = $(this).data('active'); 1291 } 1292 1293 var $trackColor = '#fff'; 1294 1295 if($(this).data('noactive') !== ""){ 1296 $trackColor = $(this).data('noactive'); 1297 } 1298 1299 var $line_width = 10; 1300 1301 if($(this).data('linewidth') !== ""){ 1302 $line_width = $(this).data('linewidth'); 1303 } 1304 1305 var $size = 174; 1306 1307 $(this).appear(function() { 1308 initToCounterPieChart($(this)); 1309 $(this).parent().css('opacity', '1'); 1310 1311 $(this).easyPieChart({ 1312 barColor: $barColor, 1313 trackColor: $trackColor, 1314 scaleColor: false, 1315 lineCap: 'butt', 1316 lineWidth: $line_width, 1317 animate: 1500, 1318 size: $size 1319 }); 1320 },{accX: 0, accY: -150}); 1321 }); 1322 } 1323} 1324 1325/* 1326** Pie Chart shortcode 1327*/ 1328function initPieChartWithIcon(){ 1329 "use strict"; 1330 1331 if($('.q_percentage_with_icon').length){ 1332 $('.q_percentage_with_icon').each(function() { 1333 1334 var $barColor = piechartcolor; 1335 1336 if($(this).data('active') !== ""){ 1337 $barColor = $(this).data('active'); 1338 } 1339 1340 var $trackColor = '#fff'; 1341 1342 if($(this).data('noactive') !== ""){ 1343 $trackColor = $(this).data('noactive'); 1344 } 1345 1346 var $line_width = 10; 1347 1348 if($(this).data('linewidth') !== ""){ 1349 $line_width = $(this).data('linewidth'); 1350 } 1351 1352 var $size = 174; 1353 1354 $(this).appear(function() { 1355 $(this).parent().css('opacity', '1'); 1356 $(this).css('opacity', '1'); 1357 $(this).easyPieChart({ 1358 barColor: $barColor, 1359 trackColor: $trackColor, 1360 scaleColor: false, 1361 lineCap: 'butt', 1362 lineWidth: $line_width, 1363 animate: 1500, 1364 size: $size 1365 }); 1366 },{accX: 0, accY: -150}); 1367 }); 1368 } 1369} 1370 1371/* 1372** Counter for pie chart number from zero to defined number 1373*/ 1374function initToCounterPieChart($this){ 1375 "use strict"; 1376 1377 $($this).css('opacity', '1'); 1378 var $max = parseFloat($($this).find('.tocounter').text()); 1379 $($this).find('.tocounter').countTo({ 1380 from: 0, 1381 to: $max, 1382 speed: 1500, 1383 refreshInterval: 50 1384 }); 1385} 1386 1387/* 1388** Init Portfolio list and Portfolio Filter 1389*/ 1390function initPortfolio(){ 1391 "use strict"; 1392 1393 if($('.projects_holder_outer:not(.masonry_with_space)').length){ 1394 $('.projects_holder_outer').each(function(){ 1395 1396 $('.filter_holder .filter').on('click',function(){ 1397 var $this = $(this).text(); 1398 var dropLabels = $('.filter_holder').find('.label span'); 1399 dropLabels.each(function(){ 1400 $(this).text($this); 1401 }); 1402 }); 1403 1404/* MVMVMVMV "mixitup" is not defined 1405 $(this).find('.projects_holder').mixitup({ 1406 showOnLoad: 'all', 1407 transitionSpeed: 600, 1408 minHeight: 150 1409 }); 1410*/ 1411 }); 1412 } 1413} 1414 1415/* 1416 ** Init z-index for portfolio items 1417 */ 1418function initPortfolioZIndex(){ 1419 "use strict"; 1420 1421 if($('.projects_holder_outer.portfolio_no_space').length){ 1422 $('.no_space.hover_text article').each(function(i){ 1423 $(this).css('z-index', i +10); 1424 }); 1425 } 1426} 1427 1428function initPortfolioMasonry(){ 1429 "use strict"; 1430 1431 if($('.projects_masonry_holder, .masonry_with_space').length){ 1432 1433 $('.projects_masonry_holder, .masonry_with_space .projects_holder').each(function(){ 1434 var $window = jQuery(window); 1435 var $this = $(this); 1436 $this.waitForImages(function(){ 1437 $this.animate({opacity:1}); 1438 if($('.projects_masonry_holder').length){ 1439 resizeMasonry($this); 1440 } 1441 $this.isotope({ 1442 itemSelector: '.portfolio_masonry_item, .masonry_with_space .mix', 1443 layoutMode: 'masonry' 1444 }); 1445 1446 if($('.projects_masonry_holder').length){ 1447 setPortfolioMasZIndex(); 1448 $window.resize(function() {resizeMasonry($this); setPortfolioMasZIndex();}); 1449 } 1450 }); 1451 }); 1452 } 1453} 1454 1455var portfolio_width; 1456function resizeMasonry(container){ 1457 "use strict"; 1458 1459 var $window = jQuery(window); 1460 1461 if($('.full_width').length){ 1462 if($('body').hasClass('vertical_menu_enabled') && $window_width > 1000){ 1463 portfolio_width = $window.innerWidth() - 260; // 260 is left menu area width 1464 } else { 1465 portfolio_width = $window.innerWidth(); 1466 } 1467 }else{ 1468 var closest_container = container.closest('.container_inner'); 1469 if(closest_container.has('.column_inner').length) { 1470 portfolio_width = container.closest('.column_inner').innerWidth(); 1471 } else { 1472 portfolio_width = closest_container.innerWidth(); 1473 } 1474 } 1475 1476 container.width(portfolio_width); 1477 1478 var $cols = 5; 1479 if(portfolio_width > 1600){ 1480 $cols = 5; 1481 }else if(portfolio_width <= 1600 && portfolio_width > 1300){ 1482 $cols = 4; 1483 }else if(portfolio_width <= 1300 && portfolio_width > 1000){ 1484 $cols = 3; 1485 }else if(portfolio_width <= 1000 && portfolio_width > 480){ 1486 $cols = 2; 1487 }else if(portfolio_width <= 480){ 1488 $cols = 1; 1489 } 1490 1491 var largeItemHeight = container.find('article[class*="default"]:first img').height(); 1492 var double = ($window.innerWidth() > 480) ? 2 : 1 ; 1493 container.find('article[class*="large_width_height"] img, article[class*="large_height"] img').css('height',(largeItemHeight*double)); 1494 1495 container.isotope({ 1496 masonry: { columnWidth: portfolio_width / parseInt($cols)} 1497 });
1498} 1499 1500function setPortfolioMasZIndex(){ 1501 "use strict"; 1502 1503 var $elemXPos = {}; 1504 var $elemZIndex = {}; 1505 1506 $('.projects_masonry_holder article').each(function(){ 1507 $elemXPos[$(this).index()] = getPortfolioXPos($(this).css('left')); 1508 }); 1509 1510 var $elemXPosArray = $.map($elemXPos, function (value) { return value; }); 1511 $elemXPosArray = cleanPortfolioMasXArray($elemXPosArray); 1512 $elemXPosArray.sort(function(x,y){return x-y}); 1513 1514 for(var i = 0; i < $elemXPosArray.length; i++){ 1515 $elemZIndex[$elemXPosArray[i]] = i*10; 1516 } 1517 1518 $.each($elemXPos,function(key,val){ 1519 1520 var $zi; 1521 var $bgd = val; 1522 $.each($elemZIndex,function(key,val){ 1523 if($bgd == key) { 1524 $zi = val; 1525 } 1526 }); 1527 1528 $('.projects_masonry_holder article:eq('+key+')').css('z-index',$zi); 1529 }); 1530} 1531 1532function getPortfolioXPos(css) { 1533 //return css.substr(7, css.length - 8).split(', ')[4]; 1534 return css.substr(0, css.length - 2); 1535} 1536 1537function initPortfolioMasonryFilter(){ 1538 "use strict"; 1539 1540 var portfolioIsotopeAnimation = null; 1541 $('.filter:first').addClass('current'); 1542 $('.filter').click(function(){ 1543 1544 clearTimeout(portfolioIsotopeAnimation); 1545 $('.isotope, .isotope .isotope-item').css('transition-duration','0.8s'); 1546 portfolioIsotopeAnimation = setTimeout(function(){ $('.isotope, .isotope .isotope-item').css('transition-duration','0s'); },700); 1547 1548 var selector = $(this).attr('data-filter'); 1549 $('.projects_masonry_holder, .masonry_with_space .projects_holder').isotope({ filter: selector }); 1550 1551 $(".filter").removeClass("current"); 1552 $(this).addClass("current"); 1553 1554 setTimeout(setPortfolioMasZIndex(),700); 1555 1556 return false; 1557 }); 1558 1559} 1560 1561/* 1562 ** Load more portfolios 1563 */ 1564function loadMore(){ 1565 "use strict"; 1566 1567 var i = 1; 1568 1569 $('.load_more a').on('click', function(e) { 1570 e.preventDefault(); 1571 1572 var link = $(this).attr('href'); 1573 var $content = '.projects_holder'; 1574 var $anchor = '.portfolio_paging .load_more a'; 1575 var $elem = '.mix'; 1576 var $next_href = $($anchor).attr('href'); // Get URL for the next set of posts 1577 var filler_num = $('.projects_holder .filler').length; 1578 1579 var load_more_holder = $('.portfolio_paging'); 1580 var loading_holder = $('.portfolio_paging_loading'); 1581 1582 load_more_holder.hide(); 1583 loading_holder.show(); 1584 1585 $.get(link+'', function(data){ 1586 $('.projects_holder .filler').slice(-filler_num).remove(); 1587 1588 var $new_content = $($content, data).wrapInner('').html(); // Grab just the content 1589 $next_href = $($anchor, data).attr('href'); // Get the new href 1590 1591 $($content, data).waitForImages(function() { 1592 1593 $('article.mix:last').after($new_content); // Append the new content 1594 1595 if($('.masonry_with_space').length){ 1596 $('.masonry_with_space .projects_holder').isotope('reloadItems').isotope(); 1597 }else{ 1598 var min_height = $('article.mix:first').height(); 1599 $('article.mix').css('min-height',min_height); 1600 $('.projects_holder').mixitup('remix','all'); 1601 } 1602 prettyPhoto(); 1603 if($('.load_more').attr('rel') > i) { 1604 $('.load_more a').attr('href', $next_href); // Change the next URL 1605 } else { 1606 $('.load_more').remove(); 1607 } 1608 $('.projects_holder .portfolio_paging:last').remove(); // Remove the original navigation 1609 $('article.mix').css('min-height',0); 1610 1611 load_more_holder.show(); 1612 loading_holder.hide(); 1613 }); 1614 }); 1615 i++; 1616 }); 1617} 1618 1619/* 1620 ** Picture popup for portfolio lists and portfolio single 1621 */ 1622function prettyPhoto(){ 1623 "use strict"; 1624 1625 $('a[data-rel]').each(function() { 1626 $(this).attr('rel', $(this).data('rel')); 1627 }); 1628 1629 $("a[rel^='prettyPhoto']").prettyPhoto({ 1630 animation_speed: 'normal', /* fast/slow/normal */ 1631 slideshow: false, /* false OR interval time in ms */ 1632 autoplay_slideshow: false, /* true/false */ 1633 opacity: 0.80, /* Value between 0 and 1 */ 1634 show_title: true, /* true/false */ 1635 allow_resize: true, /* Resize the photos bigger than viewport. true/false */ 1636 horizontal_padding: 0, 1637 default_width: 960, 1638 default_height: 540, 1639 counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ 1640 theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */ 1641 hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ 1642 wmode: 'opaque', /* Set the flash wmode attribute */ 1643 autoplay: true, /* Automatically start videos: True/False */ 1644 modal: false, /* If set to true, only the close button will close the window */ 1645 overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ 1646 keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */ 1647 deeplinking: false, 1648 social_tools: false 1649 });
1650} 1651 1652function checkTitleToShowOrHide(){ 1653 if($('.title_outer.animate_title_area').length){ 1654 var title_area_height = $('.title_outer').data('height'); 1655 if($scroll > $('.title').height()){ 1656 $('.title_outer').css({'height':title_area_height, 'opacity':'1', 'overflow':'visible'}); 1657 } 1658 } 1659} 1660 1661/* 1662** Title area animation 1663*/ 1664function initTitleAreaAnimation(){ 1665 if($('.title_outer.animate_title_area').length){ 1666 1667 var title_area_height = $('.title_outer').data('height'); 1668 if($('.title_outer').hasClass('with_image')){ 1669 title_area_height = $('.image.responsive').height(); 1670 } 1671 if($scroll < $('.title').height()){ 1672 $('.title_outer').animate({ height: title_area_height, opacity: 1}, 500, function(){ 1673 $(this).css({'overflow':'visible'}); 1674 initPortfolioSingleInfo(); 1675 }); 1676 } 1677 } 1678} 1679 1680function cleanPortfolioMasXArray($elemXPosArray) { 1681 var i; 1682 var length = $elemXPosArray.length; 1683 var $elemXPosOutArray = []; 1684 var tmp = {}; 1685 1686 for (i = 0; i < length; i++) { 1687 tmp[$elemXPosArray[i]] = 0; 1688 } 1689 for (i in tmp) { 1690 $elemXPosOutArray.push(i); 1691 } 1692 return $elemXPosOutArray; 1693} 1694 1695/* 1696** Title image with parallax effect 1697*/ 1698function initParallaxTitle(){ 1699 "use strict"; 1700 1701 if(($('.title').length > 0) && ($('.touch').length === 0)){ 1702 1703 if($('.title.has_fixed_background').length){ 1704 1705 var $background_size_width = parseInt($('.title.has_fixed_background').css('background-size').match(/\d+/)); 1706 1707 var title_holder_height = $('.title.has_fixed_background').height(); 1708 var title_rate = (title_holder_height / 10000) * 7; 1709 1710 var title_distance = $scroll - $('.title.has_fixed_background').offset().top; 1711 var title_bpos = -(title_distance * title_rate); 1712 $('.title.has_fixed_background').css({'background-position': 'center '+ (0+add_for_admin_bar) +'px' }); 1713 if($('.title.has_fixed_background').hasClass('zoom_out')){ 1714 $('.title.has_fixed_background').css({'background-size': $background_size_width-$scroll + 'px auto'}); 1715 } 1716 } 1717 1718 $(window).on('scroll', function() { 1719 if($('.title.has_fixed_background').length){ 1720 1721 var title_distance = $scroll - $('.title.has_fixed_background').offset().top; 1722 1723 var title_bpos = -(title_distance * title_rate); 1724 $('.title.has_fixed_background').css({'background-position': 'center ' + (title_bpos+add_for_admin_bar) + 'px' }); 1725 if($('.title.has_fixed_background').hasClass('zoom_out')){ 1726 $('.title.has_fixed_background').css({'background-size': $background_size_width-$scroll + 'px auto'}); 1727 } 1728 } 1729 }); 1730 } 1731} 1732 1733/* 1734 Plugin: jQuery Parallax 1735 Version 1.1.3 1736 Author: Ian Lunn 1737 Twitter: @IanLunn 1738 Author URL: http://www.ianlunn.co.uk/ 1739 Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ 1740 1741 Dual licensed under the MIT and GPL licenses: 1742 http://www.opensource.org/licenses/mit-license.php 1743 http://www.gnu.org/licenses/gpl.html 1744 */ 1745 1746(function( $ ){ 1747 var $window = $(window); 1748 var windowHeight = $window.height(); 1749 1750 $window.resize(function () { 1751 windowHeight = $window.height(); 1752 }); 1753 1754 $.fn.parallax = function(xpos, speedFactor, outerHeight) { 1755 var $this = $(this); 1756 var getHeight; 1757 var firstTop; 1758 var paddingTop = 0; 1759 1760 //get the starting position of each element to have parallax applied to it 1761 $this.each(function(){ 1762 firstTop = $this.offset().top; 1763 }); 1764 1765 if (outerHeight) { 1766 getHeight = function(jqo) { 1767 return jqo.outerHeight(true); 1768 }; 1769 } else { 1770 getHeight = function(jqo) { 1771 return jqo.height(); 1772 }; 1773 } 1774 1775 // setup defaults if arguments aren't specified 1776 if (arguments.length < 1 || xpos === null) xpos = "50%"; 1777 if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; 1778 if (arguments.length < 3 || outerHeight === null) outerHeight = true; 1779 1780 // function to be called whenever the window is scrolled or resized
1781 function update(){ 1782 var pos = $window.scrollTop(); 1783 1784 $this.each(function(){ 1785 var $element = $(this); 1786 var top = $element.offset().top; 1787 var height = getHeight($element); 1788 1789 // Check if totally above or totally below viewport 1790 if (top + height < pos || top > pos + windowHeight) { 1791 return; 1792 } 1793 1794 $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); 1795 }); 1796 } 1797 1798 $window.bind('scroll', update).resize(update); 1799 update(); 1800 }; 1801})(jQuery); 1802 1803 1804/* 1805 ** Sections with parallax background image 1806 */ 1807function initParallax(){ 1808 "use strict"; 1809 1810 if($('.parallax_section_holder').length){ 1811 $('.parallax_section_holder').each(function() { 1812 var speed = $(this).data('speed')*0.4; 1813 $(this).parallax("50%", speed); 1814 }); 1815 } 1816} 1817 1818/* 1819** Smooth scroll functionality for Side Area 1820*/ 1821function initSideAreaScroll(){ 1822 "use strict"; 1823 1824 if($('.side_menu').length){ 1825 $(".side_menu").niceScroll({ 1826 scrollspeed: 60, 1827 mousescrollstep: 40, 1828 cursorwidth: 0, 1829 cursorborder: 0, 1830 cursorborderradius: 0, 1831 cursorcolor: "transparent", 1832 autohidemode: false, 1833 horizrailenabled: false 1834 }); 1835 } 1836} 1837 1838/* 1839 ** Smooth scroll functionality for Vertical Menu Area Toogle style 1840 */ 1841function initVerticalAreaMenuScroll(){ 1842 "use strict"; 1843 1844 if($('.vertical_menu_area.with_scroll').length){ 1845 $(".vertical_menu_area.with_scroll").niceScroll({ 1846 scrollspeed: 60, 1847 mousescrollstep: 40, 1848 cursorwidth: 0, 1849 cursorborder: 0, 1850 cursorborderradius: 0, 1851 cursorcolor: "transparent", 1852 autohidemode: false, 1853 horizrailenabled: false 1854 }); 1855 } 1856} 1857 1858/* 1859** Show/Hide Mobile menu 1860*/ 1861function initMobileMenu(){ 1862 "use strict"; 1863 1864 $(".mobile_menu_button span").on('tap click', function(e){ 1865 e.preventDefault(); 1866 1867 if ($(".mobile_menu > ul").is(":visible")){ 1868 $(".mobile_menu > ul").slideUp(200); 1869 } else { 1870 $(".mobile_menu > ul").slideDown(200); 1871 } 1872 }); 1873 1874 $(".mobile_menu > ul > li.has_sub > span.mobile_arrow, .mobile_menu > ul > li.has_sub > h3, .mobile_menu > ul > li.has_sub > a[href*='#']").on('tap click', function(e){ 1875 e.preventDefault(); 1876 1877 if ($(this).closest('li.has_sub').find("> ul.sub_menu").is(":visible")){ 1878 $(this).closest('li.has_sub').find("> ul.sub_menu").slideUp(200); 1879 $(this).closest('li.has_sub').removeClass('open_sub'); 1880 } else { 1881 $(this).closest('li.has_sub').addClass('open_sub'); 1882 $(this).closest('li.has_sub').find("> ul.sub_menu").slideDown(200); 1883 } 1884 }); 1885 1886 $(".mobile_menu > ul > li.has_sub > ul.sub_menu > li.has_sub > span.mobile_arrow, .mobile_menu > ul > li.has_sub > ul.sub_menu > li.has_sub > h3, .mobile_menu > ul > li.has_sub > ul.sub_menu > li.has_sub > a[href*='#']").on('tap click', function(e){ 1887 e.preventDefault(); 1888 1889 if ($(this).parent().find("ul.sub_menu").is(":visible")){ 1890 $(this).parent().find("ul.sub_menu").slideUp(200); 1891 $(this).parent().removeClass('open_sub'); 1892 } else { 1893 $(this).parent().addClass('open_sub'); 1894 $(this).parent().find("ul.sub_menu").slideDown(200); 1895 } 1896 }); 1897 1898 $(".mobile_menu ul li > a, .q_logo a").on('click', function(){ 1899 1900 if(($(this).attr('href') !== "http://#") && ($(this).attr('href') !== "#")){ 1901 $(".mobile_menu > ul").slideUp(); 1902 } 1903 }); 1904} 1905 1906/* 1907** Init flexslider for portfolio single 1908*/ 1909function initFlexSlider(){ 1910 "use strict"; 1911 $('.flexslider').each(function(){ 1912 var interval = 8000; 1913 if(typeof $(this).data('interval') !== 'undefined' && $(this).data('interval') !== false) { 1914 interval = parseFloat($(this).data('interval')) * 1000; 1915 } 1916 1917 var slideshow = true; 1918 if(interval === 0) { 1919 slideshow = false; 1920 } 1921 1922 var animation = 'slide'; 1923 if(typeof $(this).data('flex_fx') !== 'undefined' && $(this).data('flex_fx') !== false) { 1924 animation = $(this).data('flex_fx'); 1925 } 1926 1927 $(this).flexslider({ 1928 animationLoop: true, 1929 controlNav: false,
1930 useCSS: false, 1931 pauseOnAction: true, 1932 pauseOnHover: true, 1933 slideshow: slideshow, 1934 animation: animation, 1935 prevText: "<span class='arrow_carrot-left'></span>", 1936 nextText: "<span class='arrow_carrot-right'></span>", 1937 animationSpeed: 600, 1938 slideshowSpeed: interval, 1939 start: function(){ 1940 setTimeout(function(){$(".flexslider").fitVids();},100); 1941 } 1942 }); 1943 1944 $('.flex-direction-nav a').click(function(e){ 1945 e.preventDefault(); 1946 e.stopImmediatePropagation(); 1947 e.stopPropagation(); 1948 }); 1949 }); 1950} 1951 1952/* 1953** Init fitVideo function for responsive video files 1954*/ 1955function fitVideo(){ 1956 "use strict"; 1957 1958 $(".portfolio_images").fitVids(); 1959 $(".video_holder").fitVids(); 1960 $(".format-video .post_image").fitVids(); 1961 $(".format-video .q_masonry_blog_post_image").fitVids(); 1962} 1963 1964/* 1965** Function for follow portfolio single descripton 1966*/ 1967var $scrollHeight; 1968function initPortfolioSingleInfo(){ 1969 "use strict"; 1970 1971 var $sidebar = $(".portfolio_single_follow"); 1972 if($(".portfolio_single_follow").length > 0){ 1973 1974 var offset = $sidebar.offset(); 1975 $scrollHeight = $(".portfolio_container").height(); 1976 var $scrollOffset = $(".portfolio_container").offset(); 1977 var $window = $(window); 1978 1979 var $headerHeight = parseInt($('header.page_header').css('height'), 10); 1980 1981 $window.scroll(function() { 1982 if($window.width() > 960){ 1983 if ($window.scrollTop() + $headerHeight > offset.top) { 1984 if ($window.scrollTop() + $headerHeight + $sidebar.height() + 24 < $scrollOffset.top + $scrollHeight) { 1985 1986 $sidebar.stop().animate({ 1987 marginTop: $window.scrollTop() - offset.top + $headerHeight 1988 }); 1989 } else { 1990 $sidebar.stop().animate({ 1991 marginTop: $scrollHeight - $sidebar.height() - 24 1992 }); 1993 } 1994 } else { 1995 $sidebar.stop().animate({ 1996 marginTop: 0 1997 }); 1998 } 1999 }else{ 2000 $sidebar.css('margin-top',0); 2001 } 2002 }); 2003 } 2004} 2005 2006/* 2007** Init tabs shortcodes 2008*/ 2009function initTabs(){ 2010 "use strict"; 2011 if($('.q_tabs').length){ 2012 $('.q_tabs').appear(function() { 2013 $('.q_tabs').css('visibility', 'visible'); 2014 },{accX: 0, accY: -100}); 2015 var $tabsNav = $('.tabs-nav'); 2016 var $tabsNavLis = $tabsNav.children('li'); 2017 $tabsNav.each(function() { 2018 var $this = $(this); 2019 $this.next().children('.tab-content').stop(true,true).hide().first().show(); 2020 $this.children('li').first().addClass('active').stop(true,true).show(); 2021 }); 2022 $tabsNavLis.on('click', function(e) { 2023 var $this = $(this); 2024 $this.siblings().removeClass('active').end().addClass('active'); 2025 $this.parent().next().children('.tab-content').stop(true,true).hide().siblings( $this.find('a').attr('href') ).fadeIn(); 2026 e.preventDefault(); 2027 }); 2028 } 2029} 2030 2031/* 2032 ** Init accordion and toogle shortcodes 2033 */ 2034function initAccordion() { 2035 "use strict"; 2036 2037 if($(".q_accordion_holder").length){ 2038 $(".q_accordion_holder").appear(function() { 2039 $(".q_accordion_holder").css('visibility', 'visible'); 2040 },{accX: 0, accY: -100}); 2041 2042 if ($(".accordion").length) { 2043 $(".accordion").accordion({ 2044 animate: "swing", 2045 collapsible: true, 2046 active: false, 2047 icons: "", 2048 heightStyle: "content" 2049 }); 2050 2051 //define custom options for each accordion 2052 $(".accordion").each(function() { 2053 var activeTab = parseInt($(this).data('active-tab')); 2054 if(activeTab !== "") { 2055 activeTab = activeTab - 1; // - 1 because active tab is set in 0 index base 2056 $(this).accordion('option', 'active', activeTab); 2057 } 2058 var borderRadius = parseInt($(this).data('border-radius')); 2059 2060 if(borderRadius !== "") { 2061 $(this).find('.accordion_mark').css('border-radius', borderRadius+"px"); 2062 } 2063 var collapsible = ($(this).data('collapsible') == 'yes') ? true : false; 2064 $(this).accordion('option', 'collapsible', collapsible); 2065 $(this).accordion('option', 'collapsible', collapsible); 2066 }); 2067 } 2068 $(".toggle").addClass("accordion ui-accordion ui-accordion-icons ui-widget ui-helper-reset") 2069 .find(".title-holder") 2070 .addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom") 2071 .hover(function() { 2072 $(this).toggleClass("ui-state-hover"); 2073 }) 2074 .click(function() { 2075 $(this) 2076 .toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom") 2077 .next().toggleClass("ui-accordion-content-active").slideToggle(400); 2078 return false; 2079 }) 2080 .next() 2081 .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom") 2082 .hide(); 2083 2084 $(".toggle").each(function() { 2085 var activeTab = parseInt($(this).data('active-tab')); 2086 2087 var borderRadius = parseInt($(this).data('border-radius')); 2088 2089 if(borderRadius !== "") { 2090 $(this).find('.accordion_mark').css('border-radius', borderRadius+"px"); 2091 } 2092 2093 if(activeTab !== "" && activeTab >= 1) { 2094 activeTab = activeTab - 1; // - 1 because active tab is set in 0 index base 2095 $(this).find('.ui-accordion-content').eq(activeTab).show(); 2096 $(this).find('.ui-accordion-header').eq(activeTab).addClass('ui-state-active'); //set active accordion header 2097 } 2098 2099 }); 2100 } 2101} 2102 2103/* 2104** Function to enable link in accordion 2105*/ 2106function initAccordionContentLink(){ 2107 "use strict"; 2108 2109 if($(".accordion").length){
2110 $('.accordion_holder .accordion_inner .accordion_content a').click(function(){ 2111 if($(this).attr('target') === '_blank'){ 2112 window.open($(this).attr('href'),'_blank'); 2113 }else{ 2114 window.open($(this).attr('href'),'_self'); 2115 } 2116 return false; 2117 }); 2118 } 2119} 2120 2121/* 2122** Init testimonials shortcode 2123*/ 2124function initTestimonials(){ 2125 "use strict"; 2126 2127 if($('.testimonials_carousel').length){ 2128 $('.testimonials_carousel').each(function(){ 2129 $(this).appear(function() { 2130 $(this).css('visibility','visible'); 2131 },{accX: 0, accY: -100}); 2132 2133 var interval = 5000; 2134 if(typeof $(this).data('auto-rotate-slides') !== 'undefined' && $(this).data('auto-rotate-slides') !== false) { 2135 interval = parseFloat($(this).data('auto-rotate-slides')) * 1000; 2136 } 2137 2138 var slideshow = true; 2139 if(interval === 0) { 2140 slideshow = false; 2141 } 2142 2143 var animation = 'fade'; 2144 if(typeof $(this).data('animation-type') !== 'undefined' && $(this).data('animation-type') !== false) { 2145 animation = $(this).data('animation-type'); 2146 } 2147 2148 var directionNav = true; 2149 if(typeof $(this).data('show-navigation') !== 'undefined') { 2150 directionNav = $(this).data('show-navigation') == 'no' ? false : true; 2151 } 2152 2153 var animationSpeed = 600; 2154 if(typeof $(this).data('animation-speed') !== 'undefined' && $(this).data('animation-speed') !== false) { 2155 animationSpeed = $(this).data('animation-speed'); 2156 } 2157 2158 $(this).flexslider({ 2159 animationLoop: true, 2160 controlNav: directionNav, 2161 directionNav: false, 2162 useCSS: false, 2163 pauseOnAction: true, 2164 pauseOnHover: false, 2165 slideshow: slideshow, 2166 animation: animation, 2167 itemMargin: 25, 2168 minItems: 1, 2169 maxItems: 1, 2170 animationSpeed: animationSpeed, 2171 slideshowSpeed: interval, 2172 start: function(slider){ 2173 initParallax(); 2174 } 2175 }); 2176 }); 2177 2178 } 2179} 2180 2181/* 2182** Function to close message shortcode 2183*/ 2184function initMessages(){ 2185 "use strict"; 2186 2187 if($('.q_message').length){ 2188 $('.q_message').each(function(){ 2189 $(this).find('.close').click(function(e){ 2190 e.preventDefault(); 2191 $(this).parent().parent().fadeOut(500); 2192 }); 2193 }); 2194 } 2195} 2196/* 2197** Init Element Animations 2198*/ 2199function initElementsAnimation(){ 2200 "use strict"; 2201 2202 if($(".element_from_fade").length > 0 && $('.no_animation_on_touch').length === 0){ 2203 $('.element_from_fade').each(function(){ 2204 var $this = $(this); 2205 2206 $this.appear(function() { 2207 $this.addClass('element_from_fade_on'); 2208 },{accX: 0, accY: -100}); 2209 }); 2210 } 2211 2212 if($(".element_from_left").length > 0 && $('.no_animation_on_touch').length === 0){ 2213 $('.element_from_left').each(function(){ 2214 var $this = $(this); 2215 2216 $this.appear(function() { 2217 $this.addClass('element_from_left_on'); 2218 },{accX: 0, accY: -100}); 2219 }); 2220 } 2221 2222 if($(".element_from_right").length > 0 && $('.no_animation_on_touch').length === 0){ 2223 $('.element_from_right').each(function(){ 2224 var $this = $(this); 2225 2226 $this.appear(function() { 2227 $this.addClass('element_from_right_on'); 2228 },{accX: 0, accY: -100}); 2229 }); 2230 } 2231 2232 if($(".element_from_top").length > 0 && $('.no_animation_on_touch').length === 0){ 2233 $('.element_from_top').each(function(){ 2234 var $this = $(this); 2235 2236 $this.appear(function() { 2237 $this.addClass('element_from_top_on'); 2238 },{accX: 0, accY: -100}); 2239 }); 2240 } 2241 2242 if($(".element_from_bottom").length > 0 && $('.no_animation_on_touch').length === 0){ 2243 $('.element_from_bottom').each(function(){ 2244 var $this = $(this); 2245 2246 $this.appear(function() { 2247 $this.addClass('element_from_bottom_on'); 2248 }
2248,{accX: 0, accY: -100}); 2249 }); 2250 } 2251 2252 if($(".element_transform").length > 0 && $('.no_animation_on_touch').length === 0){ 2253 $('.element_transform').each(function(){ 2254 var $this = $(this); 2255 2256 $this.appear(function() { 2257 $this.addClass('element_transform_on'); 2258 },{accX: 0, accY: -100}); 2259 }); 2260 } 2261} 2262 2263/* 2264** Init audio player for blog layout 2265*/ 2266function fitAudio(){ 2267 "use strict"; 2268 2269 $('audio.blog_audio').mediaelementplayer({ 2270 audioWidth: '100%' 2271 }); 2272} 2273 2274/* 2275** Init masonry layout for blog template 2276*/ 2277function initBlog(){ 2278 "use strict"; 2279 2280 if($('.blog_holder.masonry').length){ 2281 var width_blog = $(this).closest('.container_inner').width(); 2282 if($('.blog_holder.masonry').closest(".column_inner").length) { 2283 width_blog = $('.blog_holder.masonry').closest(".column_inner").width(); 2284 } 2285 $('.blog_holder.masonry').width(width_blog); 2286 var $container = $('.blog_holder.masonry'); 2287 var $cols = 3; 2288 2289 if($container.width() < 420) { 2290 $cols = 1; 2291 } else if($container.width() <= 805) { 2292 $cols = 2; 2293 } 2294 2295 $container.isotope({ 2296 itemSelector: 'article', 2297 resizable: false, 2298 masonry: { columnWidth: $('.blog_holder.masonry').width() / $cols } 2299 }); 2300 2301 $('.filter').click(function(){ 2302 var selector = $(this).attr('data-filter'); 2303 $container.isotope({ filter: selector }); 2304 return false; 2305 }); 2306 2307 if( $container.hasClass('masonry_infinite_scroll')){ 2308 $container.infinitescroll({ 2309 navSelector : '.blog_infinite_scroll_button span', 2310 nextSelector : '.blog_infinite_scroll_button span a', 2311 itemSelector : 'article', 2312 loading: { 2313 finishedMsg: finished_text, 2314 msgText : loading_text 2315 } 2316 }, 2317 // call Isotope as a callback 2318 function( newElements ) { 2319 $container.isotope( 'appended', $( newElements ) ); 2320 fitVideo(); 2321 fitAudio(); 2322 initFlexSlider(); 2323 setTimeout(function(){ 2324 $('.blog_holder.masonry').isotope( 'layout'); 2325 },400); 2326 } 2327 ); 2328 }else if($container.hasClass('masonry_load_more')){ 2329 2330 var i = 1; 2331 $('.blog_load_more_button a').on('click', function(e) { 2332 e.preventDefault(); 2333 2334 var link = $(this).attr('href'); 2335 var $content = '.masonry_load_more'; 2336 var $anchor = '.blog_load_more_button a'; 2337 var $next_href = $($anchor).attr('href'); 2338 $.get(link+'', function(data){ 2339 var $new_content = $($content, data).wrapInner('').html(); 2340 $next_href = $($anchor, data).attr('href'); 2341 $container.append( $( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); 2342 fitVideo(); 2343 fitAudio(); 2344 initFlexSlider(); 2345 setTimeout(function(){ 2346 $('.blog_holder.masonry').isotope( 'layout'); 2347 },400); 2348 if($('.blog_load_more_button span').attr('rel') > i) { 2349 $('.blog_load_more_button a').attr('href', $next_href); // Change the next URL 2350 } else { 2351 $('.blog_load_more_button').remove(); 2352 } 2353 }); 2354 i++; 2355 }); 2356 } 2357 2358 $(window).resize(function(){ 2359 if($container.width() < 420) { 2360 $cols = 1; 2361 } else if($container.width() <= 785) { 2362 $cols = 2; 2363 } else { 2364 $cols = 3; 2365 } 2366 }); 2367 2368 $('.blog_holder.masonry, .blog_load_more_button_holder').animate({opacity: "1"}, 400, function(){ 2369 $('.blog_holder.masonry').isotope( 'layout'); 2370 }); 2371 } 2372} 2373 2374/* 2375 ** Init full width masonry layout for blog template 2376 */ 2377function initBlogMasonryFullWidth(){ 2378 "use strict"; 2379 2380 if($('.masonry_full_width').length){ 2381 var width_blog = $('.full_width_inner').width(); 2382 2383 $('.masonry_full_width').width(width_blog); 2384 var $container = $('.masonry_full_width'); 2385 var $cols = 5; 2386 2387 if($container.width() < 480) { 2388 $cols = 1; 2389 } else if($container.width() <= 703) { 2390 $cols = 2; 2391 } else if($container.width() <= 920) { 2392 $cols = 3; 2393 } else if($container.width() <= 1320) { 2394 $cols = 4; 2395 } 2396 $('.filter').click(function(){ 2397 var selector = $(this).attr('data-filter'); 2398 $container.isotope({ filter: selector }); 2399 return false; 2400 }); 2401 if( $container.hasClass('masonry_infinite_scroll')){ 2402 $container.infinitescroll({ 2403 navSelector : '.blog_infinite_scroll_button span', 2404 nextSelector : '.blog_infinite_scroll_button span a', 2405 itemSelector : 'article', 2406 loading: { 2407 finishedMsg: finished_text, 2408 msgText : loading_text 2409 } 2410 }, 2411 // call Isotope as a callback 2412 function( newElements ) { 2413 $container.isotope( 'appended', $( newElements ) ); 2414 fitVideo(); 2415 fitAudio(); 2416 initFlexSlider(); 2417 setTimeout(function(){ 2418 $('.blog_holder.masonry_full_width').isotope( 'layout'); 2419 },400); 2420 } 2421 ); 2422 }else if($container.hasClass('masonry_load_more')){ 2423 2424 var i = 1; 2425 $('.blog_load_more_button a').on('click', function(e) { 2426 e.preventDefault(); 2427 2428 var link = $(this).attr('href'); 2429 var $content = '.masonry_load_more'; 2430 var $anchor = '.blog_load_more_button a'; 2431 var $next_href = $($anchor).attr('href'); 2432 $.get(link+'', function(data){ 2433 var $new_content = $($content, data).wrapInner('').html(); 2434 $next_href = $($anchor, data).attr('href'); 2435 $container.append( $( $new_content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); 2436 fitVideo(); 2437 fitAudio(); 2438 initFlexSlider(); 2439 setTimeout(function(){ 2440 $('.blog_holder.masonry_full_width').isotope( 'layout'); 2441 },400); 2442 if($('.blog_load_more_button span').attr('rel') > i) { 2443 $('.blog_load_more_button a').attr('href', $next_href); // Change the next URL 2444 } else { 2445 $('.blog_load_more_button').remove(); 2446 } 2447 }); 2448 i++; 2449 }); 2450 } 2451 $container.isotope({ 2452 itemSelector: 'article', 2453 resizable: false, 2454 masonry: { columnWidth: $('.masonry_full_width').width() / $cols } 2455 }); 2456 2457 $(window).resize(function(){ 2458 if($container.width() < 480) { 2459 $cols = 1; 2460 } else if($container.width() <= 703) { 2461 $cols = 2; 2462 } else if($container.width() <= 920) { 2463 $cols = 3; 2464 } else if($container.width() <= 1320) { 2465 $cols = 4; 2466 } else { 2467 $cols = 5; 2468 } 2469 }); 2470 2471 $('.masonry_full_width, .blog_load_more_button_holder').animate({opacity: "1"}, 400, function(){ 2472 $('.blog_holder.masonry_full_width').isotope( 'layout'); 2473 }); 2474 } 2475} 2476 2477/* 2478** Init progress bar with icon 2479*/ 2480var timeOuts = []; 2481function initProgressBarsIcon(){ 2482 "use strict"; 2483 2484 if($('.q_progress_bars_icons_holder').length){ 2485 $('.q_progress_bars_icons_holder').each(function() { 2486 var $this = $(this); 2487 $this.appear(function() { 2488 $this.find('.q_progress_bars_icons').css('opacity','1'); 2489 $this.find('.q_progress_bars_icons').each(function() { 2490 var number = $(this).find('.q_progress_bars_icons_inner').data('number'); 2491 var size = $(this).find('.q_progress_bars_icons_inner').data('size'); 2492 2493 if(size !== ""){ 2494 $(this).find('.q_progress_bars_icons_inner.custom_size .bar').css({'width': size+'px','height':size+'px'}); 2495 $(this).find('.q_progress_bars_icons_inner.custom_size .bar .fa-stack').css({'font-size': size/2+'px'}); 2496 } 2497 2498 var bars = $(this).find('.bar'); 2499 2500 bars.each(function(i){ 2501 if(i < number){
2502 var time = (i + 1)*150; 2503 timeOuts[i] = setTimeout(function(){ 2504 $(bars[i]).addClass('active'); 2505 },time); 2506 } 2507 }); 2508 }); 2509 },{accX: 0, accY: -150}); 2510 }); 2511 } 2512} 2513 2514/* 2515** Init more facts shortcode 2516*/ 2517function initMoreFacts(){ 2518 "use strict"; 2519 2520 if($('.more_facts_holder').length){ 2521 $('.more_facts_holder').each(function(){ 2522 var $this = $(this); 2523 2524 var $more_label = 'More Facts'; 2525 2526 if($this.find('.more_facts_button').data('morefacts') !== ""){ 2527 $more_label = $this.find('.more_facts_button').data('morefacts'); 2528 } 2529 2530 var $less_label = 'Less Facts'; 2531 2532 if($this.find('.more_facts_button').data('lessfacts') !== ""){ 2533 $less_label = $this.find('.more_facts_button').data('lessfacts'); 2534 } 2535 2536 var height = $this.find('.more_facts_inner').height() + 70; 2537 2538 var speed; 2539 if(height > 0 && height < 601){ 2540 speed = 800; 2541 } else if(height > 600 && height < 1201){ 2542 speed = 1500; 2543 } else{ 2544 speed = 2100; 2545 } 2546 $this.find('.more_facts_outer').css({'height':'0px','display':'none','opacity':'0'}); 2547 2548 $this.find('.more_facts_button').on("mouseenter",function(){ 2549 $(this).css('color',$(this).data('hovercolor')); 2550 }).on("mouseleave",function() { 2551 if(!$this.find('.more_facts_outer').is(':visible')){ 2552 $(this).css('color',$(this).data('color')); 2553 } 2554 }); 2555 2556 $this.find('.more_facts_button').click(function(){ 2557 if(!$this.find('.more_facts_outer').is(':visible')){ 2558 $this.find('.more_facts_fake_arrow').fadeIn(speed); 2559 $this.addClass('more_fact_opened'); 2560 $(this).parent().parent().find('.more_facts_outer').css({'display':'block','opacity':'1'}).stop().animate({'height': height+30}, speed, function() { 2561 if($('.parallax_section_holder').length) { 2562 initParallax(); 2563 } 2564 }); 2565 $(this).find('.more_facts_button_text').text($less_label); 2566 $(this).find('.more_facts_button_arrow').addClass('rotate_arrow'); 2567 } else { 2568 $this.find('.more_facts_fake_arrow').fadeOut(speed); 2569 $(this).parent().parent().find('.more_facts_outer').stop().animate({'height': '0px'}, speed,function(){ 2570 $(this).css({'display':'none','opacity':'0'}); 2571 2572 if(!$this.find('.more_facts_button').is(":hover")){$this.find('.more_facts_button').css('color',$this.find('.more_facts_button').data('color'));} 2573 $this.removeClass('more_fact_opened'); 2574 if($('.parallax_section_holder').length) { 2575 initParallax(); 2576 } 2577 }); 2578 $(this).find('.more_facts_button_text').text($more_label); 2579 $(this).find('.more_facts_button_arrow').removeClass('rotate_arrow'); 2580 } 2581 }); 2582 }); 2583 } 2584} 2585 2586/* 2587** Replace plceholder 2588*/ 2589function placeholderReplace(){ 2590 "use strict"; 2591 2592 $('#contact-form [placeholder]').focus(function() { 2593 var input = $(this); 2594 if (input.val() === input.attr('placeholder')) { 2595 if (this.originalType) { 2596 this.type = this.originalType; 2597 delete this.originalType; 2598 } 2599 input.val(''); 2600 input.removeClass('placeholder'); 2601 } 2602 }).blur(function() { 2603 var input = $(this); 2604 if (input.val() === '') { 2605 if (this.type === 'password') { 2606 this.originalType = this.type; 2607 this.type = 'text'; 2608 } 2609 input.addClass('placeholder'); 2610 input.val(input.attr('placeholder')); 2611 } 2612 }).blur(); 2613 2614 $('#contact-form [placeholder]').parents('form').submit(function () { 2615 $(this).find('[placeholder]').each(function () { 2616 var input = $(this); 2617 if (input.val() === input.attr('placeholder')) { 2618 input.val(''); 2619 } 2620 }); 2621 }); 2622} 2623 2624function totop_button(a) { 2625 "use strict"; 2626 2627 var b = $("#back_to_top"); 2628 b.removeClass("off on"); 2629 if (a === "on") { b.addClass("on"); } else { b.addClass("off"); } 2630} 2631 2632function backButtonShowHide(){ 2633 "use strict"; 2634 2635 $(window).scroll(function () { 2636 var b = $(this).scrollTop(); 2637 var c = $(this).height(); 2638 var d; 2639 if (b > 0) { d = b + c / 2; } else { d = 1; } 2640 if (d < 1e3) { totop_button("off"); } else { totop_button("on"); } 2641 }); 2642} 2643 2644function backToTop(){ 2645 "use strict"; 2646 2647 $(document).on('click','#back_to_top',function(e){
2648 e.preventDefault(); 2649 2650 $('body,html').animate({scrollTop: 0}, $(window).scrollTop()/3, 'linear'); 2651 }); 2652} 2653 2654/* 2655 ** Init message height 2656 */ 2657function initMessageHeight(){ 2658 "use strict"; 2659 if($('.q_message.with_icon').length){ 2660 $('.q_message.with_icon').each(function(){ 2661 if($(this).find('.message_text_holder').height() > $(this).find('.q_message_icon_holder').height()) { 2662 $(this).find('.q_message_icon_holder').height($(this).find('.message_text').height()); 2663 } else { 2664 $(this).find('.message_text').height($(this).find('.q_message_icon_holder').height()); 2665 } 2666 }); 2667 } 2668} 2669 2670/** 2671 * Init image hover 2672 */ 2673function initImageHover() { 2674 "use strict"; 2675 if($('.image_hover').length){ 2676 $('.image_hover').each(function(){ 2677 $(this).appear(function() { 2678 2679 var default_visible_time = 300; 2680 var transition_delay = $(this).attr('data-transition-delay'); 2681 var real_transition_delay = default_visible_time + parseFloat(transition_delay); 2682 var object = $(this); 2683 2684 //wait for other hovers to complete 2685 setTimeout(function() { 2686 object.addClass('show'); 2687 }, parseFloat(transition_delay)); 2688 2689 //hold that image a little, than remove class 2690 setTimeout(function() { 2691 object.removeClass('show'); 2692 }, real_transition_delay); 2693 2694 },{accX: 0, accY: -200}); 2695 }); 2696 } 2697} 2698 2699/* 2700 * Initializes vertical progress bars 2701 */ 2702function initProgressBarsVertical(){ 2703 "use strict"; 2704 2705 if($('.q_progress_bars_vertical').length){ 2706 $('.q_progress_bars_vertical').each(function() { 2707 $(this).appear(function() { 2708 initToCounterVerticalProgressBar($(this)); 2709 var percentage = $(this).find('.progress_content').data('percentage'); 2710 $(this).find('.progress_content').css('height', '0%'); 2711 $(this).find('.progress_content').animate({ 2712 height: percentage+'%' 2713 }, 1500); 2714 },{accX: 0, accY: -150}); 2715 }); 2716 } 2717} 2718 2719/* 2720 * Initializes vertical progress bar count to max value 2721 */ 2722function initToCounterVerticalProgressBar($this){ 2723 "use strict"; 2724 2725 if($this.find('.progress_number span').length){ 2726 $this.find('.progress_number span').each(function() { 2727 var $max = parseFloat($(this).text()); 2728 $(this).countTo({ 2729 from: 0, 2730 to: $max, 2731 speed: 1500, 2732 refreshInterval: 50 2733 }); 2734 }); 2735 } 2736} 2737 2738/* 2739* Check if there is anchor on load and scroll to it 2740*/ 2741function checkAnchorOnLoad(){ 2742 "use strict"; 2743 2744 var hash = window.location.hash; 2745 var scrollToAmount; 2746 var top_header_height; 2747 if(hash !== "" && $('[data-q_id="'+hash+'"]').length > 0){ 2748 if($('header.page_header').hasClass('fixed') && !$('body').hasClass('vertical_menu_enabled')){ 2749 if($('header.page_header').hasClass('scroll_top')){ 2750 top_header_height = 33; 2751 }else{ 2752 top_header_height = 0; 2753 } 2754 2755 if(!$('header.page_header').hasClass('transparent') || $('header.page_header').hasClass('scrolled_not_transparent')) { 2756 if(header_height - ($('[data-q_id="' + hash + '"]').offset().top + top_header_height)/4 >= min_header_height_scroll){ 2757 var diff_of_header_and_section = $('[data-q_id="' + hash + '"]').offset().top - header_height; 2758 scrollToAmount = diff_of_header_and_section + (diff_of_header_and_section/4) + (diff_of_header_and_section/16) + (diff_of_header_and_section/64) + 1; //several times od dividing to minimize the error, because fixed header is shrinking while scroll, 1 is just to ensure 2759 }else{ 2760 if($('header.page_header').hasClass('centered_logo')){ 2761 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - logo_height - 20; //20 is top margin of logo 2762 } else { 2763 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll; 2764 } 2765 } 2766 }else{ 2767 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top; 2768 } 2769 } else if($('header.page_header').hasClass('fixed_hiding') && !$('body').hasClass('vertical_menu_enabled')){ 2770 if(!$('header.page_header').hasClass('transparent') || $('header.page_header').hasClass('scrolled_not_transparent')) { 2771 if ($('[data-q_id="' + hash + '"]').offset().top - (header_height + logo_height / 2 + 40) <= scroll_amount_for_fixed_hiding) { 2772 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - header_height - logo_height / 2 - 40; //40 is top/bottom margin of logo 2773 } else { 2774 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - min_header_height_fixed_hidden - 40; //40 is top/bottom margin of logo 2775 } 2776 }else{ 2777 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top; 2778 } 2779 }else if($('header.page_header').hasClass('stick') || $('header.page_header').hasClass('stick_with_left_r
2779ight_menu') && !$('body').hasClass('vertical_menu_enabled')) { 2780 if(!$('header.page_header').hasClass('transparent') || $('header.page_header').hasClass('scrolled_not_transparent')) { 2781 if (sticky_amount >= $('[data-q_id="' + hash + '"]').offset().top) { 2782 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top + 1; // 1 is to show sticky menu 2783 } else { 2784 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - min_header_height_sticky; 2785 } 2786 }else{ 2787 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top; 2788 } 2789 } else{ 2790 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top; 2791 } 2792 $('html, body').animate({ 2793 scrollTop: Math.round(scrollToAmount) 2794 }, 1500, function() {}); 2795 } 2796 2797 //remove active state on anchors if section is not visible 2798 $(".main_menu a, .vertical_menu a, .mobile_menu a").each(function(){ 2799 var i = $(this).prop("hash"); 2800 if(i !== "" && ($('[data-q_id="' + i + '"]').length > 0) && ($('[data-q_id="' + i + '"]').offset().top >= $window_height) && $scroll === 0){ 2801 $(this).parent().removeClass('active'); 2802 $(this).removeClass('current'); 2803 } 2804 }); 2805} 2806 2807/* 2808* Check active state of anchor links on scroll 2809*/ 2810function changeActiveState(id){ 2811 "use strict"; 2812 2813 $('.main_menu a').parent().removeClass('active'); 2814 2815 $(".main_menu a").each(function(){ 2816 var i = $(this).prop("hash"); 2817 if(i === id){ 2818 if($(this).closest('.second').length === 0){ 2819 $(this).parent().addClass('active'); 2820 }else{ 2821 $(this).closest('.second').parent().addClass('active'); 2822 } 2823 $('.main_menu a').removeClass('current'); 2824 $(this).addClass('current'); 2825 } 2826 }); 2827 2828 $('.vertical_menu a').parent().removeClass('active'); 2829 2830 $(".vertical_menu a").each(function(){ 2831 var i = $(this).prop("hash"); 2832 if(i === id){ 2833 if($(this).closest('.second').length === 0){ 2834 $(this).parent().addClass('active'); 2835 }else{ 2836 $(this).closest('.second').parent().addClass('active'); 2837 } 2838 $('.vertical_menu a').removeClass('current'); 2839 $(this).addClass('current'); 2840 } 2841 }); 2842 2843 $('.mobile_menu a').parent().removeClass('active'); 2844 2845 $(".mobile_menu a").each(function(){ 2846 var i = $(this).prop("hash"); 2847 if(i === id){ 2848 if($(this).closest('.sub_menu').length === 0){ 2849 $(this).parent().addClass('active'); 2850 }else{ 2851 $(this).closest('.sub_menu').parent().addClass('active'); 2852 } 2853 $('.mobile_menu a').removeClass('current'); 2854 $(this).addClass('current'); 2855 } 2856 }); 2857} 2858 2859/* 2860* Check active state of anchor links on scroll 2861*/ 2862function checkAnchorOnScroll(){ 2863 "use strict"; 2864 2865 if($('[data-q_id]').length && !$('header.page_header').hasClass('regular')){ 2866 $('[data-q_id]').waypoint( function(direction) { 2867 if(direction === 'down') { 2868 changeActiveState($(this).data("q_id")); 2869 } 2870 }, { offset: '50%' }); 2871 2872 $('[data-q_id]').waypoint( function(direction) { 2873 if(direction === 'up') { 2874 changeActiveState($(this).data("q_id")); 2875 } 2876 }, { offset: function(){ 2877 return -($(this).outerHeight() - 150); 2878 } }); 2879 } 2880} 2881 2882/* 2883* Init scroll to section link if that link has hash value 2884*/ 2885function initHashClick(){ 2886 "use strict"; 2887 2888 var $doc = $('html, body'); 2889 var scrollToAmount; 2890 2891 $(document).on( "click", ".main_menu a, .vertical_menu a, .qbutton:not(.contact_form_button), .anchor, .widget li.anchor a", function(){ 2892 var $this = $(this); 2893 var hash = $(this).prop("hash"); 2894 var top_header_height; 2895 if((hash !== "" && $(this).attr('href').split('#')[0] === "") || (hash !== "" && $(this).attr('href').split('#')[0] !== "" && hash === window.location.hash) || (hash !== "" && $(this).attr('href').split('#')[0] === window.location.href.split('#')[0])){ //in third condition 'hash !== ""' stays to prevent reload of page when link is active and ajax enabled 2896 if($('header.page_header').hasClass('fixed') && !$('body').hasClass('vertical_menu_enabled')){ 2897 if($('header.page_header').hasClass('scroll_top')){ 2898 top_header_height = 33; 2899 }else{ 2900 top_header_height = 0; 2901 } 2902 2903 if(!$('header.page_header').hasClass('transparent') || $('header.page_header').hasClass('scrolled_not_transparent')) { 2904 if (header_height - ($('[data-q_id="' + hash + '"]').offset().top + top_header_height) / 4 >= min_header_height_scroll) { 2905 var diff_of_header_and_section = $('[data-q_id="' + hash + '"]').offset().top - header_height; 2906 scrollToAmount = diff_of_header_and_section + (diff_of_header_and_section / 4) + (diff_of_header_and_section / 16) + (diff_of_header_and_section / 64) + 1;
2906 //several times od dividing to minimize the error, because fixed header is shrinking while scroll, 1 is just to ensure 2907 } else { 2908 if($('header.page_header').hasClass('centered_logo')){ 2909 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll - logo_height - 20; //20 is top margin of logo 2910 } else { 2911 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - min_header_height_scroll; 2912 } 2913 } 2914 }else{ 2915 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top; 2916 } 2917 } else if($('header.page_header').hasClass('fixed_hiding') && !$('body').hasClass('vertical_menu_enabled')){ 2918 if(!$('header.page_header').hasClass('transparent') || $('header.page_header').hasClass('scrolled_not_transparent')) { 2919 if ($('[data-q_id="' + hash + '"]').offset().top - (header_height + logo_height / 2 + 40) <= scroll_amount_for_fixed_hiding) { 2920 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - header_height - logo_height / 2 - 40; //20 is top/bottom margin of logo 2921 } else { 2922 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - min_header_height_fixed_hidden - 40; //20 is top/bottom margin of logo 2923 } 2924 }else{ 2925 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top; 2926 } 2927 }else if($('header.page_header').hasClass('stick') || $('header.page_header').hasClass('stick_with_left_right_menu') && !$('body').hasClass('vertical_menu_enabled')) { 2928 if(!$('header.page_header').hasClass('transparent') || $('header.page_header').hasClass('scrolled_not_transparent')) { 2929 if (sticky_amount >= $('[data-q_id="' + hash + '"]').offset().top) { 2930 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top + 1; // 1 is to show sticky menu 2931 } else { 2932 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top - min_header_height_sticky; 2933 } 2934 }else{ 2935 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top; 2936 } 2937 } else{ 2938 scrollToAmount = $('[data-q_id="' + hash + '"]').offset().top; 2939 } 2940 2941 if($('[data-q_id="'+hash+'"]').length > 0){ 2942 $doc.stop().animate({ 2943 scrollTop: Math.round(scrollToAmount) 2944 }, 1500, function() { 2945 anchorActiveState($this); 2946 }); 2947 } 2948 2949 if(history.pushState) { 2950 history.pushState(null, null, hash); 2951 } 2952 return false; 2953 } 2954 }); 2955 2956 $(document).on( "click", ".mobile_menu a", function(){ 2957 var $this = $(this); 2958 var hash = $(this).prop("hash"); 2959 if((hash !== "" && $(this).attr('href').split('#')[0] === "") || (hash !== "" && $(this).attr('href').split('#')[0] !== "" && hash === window.location.hash) || (hash !== "" && $(this).attr('href').split('#')[0] === window.location.href.split('#')[0])){ //in third condition 'hash !== ""' stays to prevent reload of page when link is active and ajax enabled 2960 2961 if($('[data-q_id="'+hash+'"]').length > 0){ 2962 $doc.animate({ 2963 scrollTop: Math.round($('[data-q_id="'+hash+'"]').offset().top - $('.mobile_menu').height()) 2964 }, 500,function(){ 2965 anchorActiveState($this); 2966 }); 2967 } 2968 if(history.pushState) { 2969 history.pushState(null, null, hash); 2970 } 2971 return false; 2972 } 2973 }); 2974} 2975 2976/* 2977** Calculate height for animated text icon shortcode 2978*/ 2979function animatedTextIconHeight(){ 2980 "use strict"; 2981
2982 if($('.animated_icons_with_text').length){ 2983 var $icons = $('.animated_icons_with_text'); 2984 var maxHeight; 2985 2986 $icons.find('.animated_text p').each(function() { 2987 maxHeight = maxHeight > $(this).height() ? maxHeight : $(this).height(); 2988 }); 2989 2990 if(maxHeight < 155) { 2991 maxHeight = 155; 2992 2993 } 2994 $icons.find('.animated_icon_with_text_inner').height(maxHeight); 2995 } 2996} 2997 2998/* 2999** Add class to items in last row in animated text icon shortcode 3000*/ 3001function countAnimatedTextIconPerRow(){ 3002 "use strict"; 3003 3004 if($('.animated_icons_with_text').length){ 3005 $('.animated_icons_with_text').each(function() { 3006 var $icons = $(this); 3007 var qode_icons_height = $icons.height(); 3008 var qode_icons_width = $icons.width(); 3009 var maxHeightIcons; 3010 var iconWidth = $icons.find('.animated_icon_with_text_holder').width() + 1; // 1px because safari round on smaller number 3011 var countIcons = $icons.find('.animated_icon_with_text_holder').length; 3012 $icons.find('.animated_icon_with_text_holder').each(function() { 3013 maxHeightIcons = maxHeightIcons > $(this).height() ? maxHeightIcons : $(this).height(); 3014 }); 3015 maxHeightIcons = maxHeightIcons + 30; //margin for client is 30 3016 var numberOfIconsPerRow = Math.ceil((qode_icons_width/iconWidth)); 3017 var numberOffullRows = Math.floor(countIcons / numberOfIconsPerRow); 3018 var numberOfIconsInLastRow = countIcons - (numberOfIconsPerRow * numberOffullRows); 3019 if(numberOfIconsInLastRow === 0){ 3020 numberOfIconsInLastRow = numberOfIconsPerRow; 3021 } 3022 $icons.find( ".animated_icon_with_text_holder" ).removeClass('border-bottom-none'); 3023 var item_start_from = countIcons - numberOfIconsInLastRow - 1; 3024 $icons.find( ".animated_icon_with_text_holder:gt("+ item_start_from +")" ).addClass('border-bottom-none'); 3025 }); 3026 } 3027} 3028 3029/* 3030* Set active state in maim menu on anchor click 3031*/ 3032function anchorActiveState(me){ 3033 if(me.closest('.main_menu').length > 0){ 3034 $('.main_menu a').parent().removeClass('active'); 3035 } 3036 3037 if(me.closest('.vertical_menu').length > 0){ 3038 $('.vertical_menu a').parent().removeClass('active'); 3039 } 3040 3041 if(me.closest('.second').length === 0){ 3042 me.parent().addClass('active'); 3043 }else{ 3044 me.closest('.second').parent().addClass('active'); 3045 } 3046 if(me.closest('.mobile_menu').length > 0){ 3047 $('.mobile_menu a').parent().removeClass('active'); 3048 me.parent().addClass('active'); 3049 } 3050 3051 $('.mobile_menu a, .main_menu a, .vertical_menu a').removeClass('current'); 3052 me.addClass('current'); 3053} 3054 3055/* 3056** Video background initialization 3057*/ 3058function initVideoBackground(){ 3059 "use strict"; 3060 3061 $('.video-wrap .video').mediaelementplayer({ 3062 enableKeyboard: false, 3063 iPadUseNativeControls: false, 3064 pauseOtherPlayers: false, 3065 // force iPhone's native controls 3066 iPhoneUseNativeControls: false, 3067 // force Android's native controls 3068 AndroidUseNativeControls: false 3069 }); 3070 3071 //mobile check 3072 if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 3073 initVideoBackgroundSize(); 3074 $('.mobile-video-image').show(); 3075 $('.video-wrap').remove(); 3076 } 3077} 3078 3079/* 3080** Calculate video background size 3081*/ 3082function initVideoBackgroundSize(){ 3083 "use strict"; 3084 3085 $('.section .video-wrap').each(function(i){ 3086 3087 var $sectionWidth = $(this).closest('.section').outerWidth(); 3088 $(this).width($sectionWidth); 3089 3090 var $sectionHeight = $(this).closest('.section').outerHeight(); 3091 min_w = vid_ratio * ($sectionHeight+20); 3092 $(this).height($sectionHeight); 3093 3094 var scale_h = $sectionWidth / video_width_original; 3095 var scale_v = ($sectionHeight - header_height) / video_height_original; 3096 var scale = scale_v; 3097 if (scale_h > scale_v) 3098 scale = scale_h; 3099 if (scale * video_width_original < min_w) {scale = min_w / video_width_original;} 3100 3101 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original +2)); 3102 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original +2)); 3103 $(this).scrollLeft(($(this).find('video').width() - $sectionWidth) / 2); 3104 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($sectionHeight)) / 2); 3105 $(this).scrollTop(($(this).find('video').height() - ($sectionHeight)) / 2); 3106 }); 3107 3108 $('.carousel .item .video .video-wrap').each(function(i){ 3109 3110 var $slideWidth = $(window).width(); 3111 $(this).width($slideWidth);
3112 3113 var mob_header = $(window).width() < 1000 ? $('header.page_header').height() - 6 : 0; // 6 is because of the display: inline-block 3114 var $slideHeight = $(this).closest('.carousel.slide').height() - mob_header; 3115 3116 min_w = vid_ratio * ($slideHeight+20); 3117 $(this).height($slideHeight); 3118 3119 var scale_h = $slideWidth / video_width_original; 3120 var scale_v = ($slideHeight - header_height) / video_height_original; 3121 var scale = scale_v; 3122 if (scale_h > scale_v) 3123 scale = scale_h; 3124 if (scale * video_width_original < min_w) {scale = min_w / video_width_original;} 3125 3126 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original +2)); 3127 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original +2)); 3128 $(this).scrollLeft(($(this).find('video').width() - $slideWidth) / 2); 3129 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($slideHeight)) / 2); 3130 $(this).scrollTop(($(this).find('video').height() - ($slideHeight)) / 2); 3131 }); 3132 3133 $('.portfolio_single .video .video-wrap, .blog_holder .video .video-wrap').each(function(i){ 3134 3135 var $this = $(this); 3136 3137 var $videoWidth = $(this).closest('.video').outerWidth(); 3138 $(this).width($videoWidth); 3139 var $videoHeight = ($videoWidth*9)/16; 3140 3141 if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 3142 $this.parent().width($videoWidth); 3143 $this.parent().height($videoHeight); 3144 } 3145 3146 min_w = vid_ratio * ($videoHeight+20); 3147 $(this).height($videoHeight); 3148 3149 var scale_h = $videoWidth / video_width_original; 3150 var scale_v = ($videoHeight - header_height) / video_height_original; 3151 var scale = scale_v; 3152 if (scale_h > scale_v) 3153 scale = scale_h; 3154 if (scale * video_width_original < min_w) {scale = min_w / video_width_original;} 3155 3156 $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original +2)); 3157 $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original +2)); 3158 $(this).scrollLeft(($(this).find('video').width() - $videoWidth) / 2); 3159 $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($videoHeight)) / 2); 3160 $(this).scrollTop(($(this).find('video').height() - ($videoHeight)) / 2); 3161 }); 3162 3163} 3164 3165/* 3166** Icon With Text animation effect 3167*/ 3168function initIconWithTextAnimation(){ 3169 "use strict"; 3170 if($('.q_icon_animation').length > 0 && $('.no_animation_on_touch').length === 0){ 3171 $('.q_icon_animation').each(function(){ 3172 $(this).appear(function() { 3173 $(this).addClass('q_show_animation'); 3174 },{accX: 0, accY: -100}); 3175 }); 3176 } 3177} 3178 3179/* 3180** Add class on body if browser is Safari 3181*/ 3182function initCheckSafariBrowser(){ 3183 "use strict"; 3184 3185 if (navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) { 3186 $('body').addClass('safari_browser'); 3187 } 3188} 3189 3190/* 3191** Add class on body if browser is Firefox Mac 3192*/ 3193function initCheckFirefoxMacBrowser(){ 3194 "use strict"; 3195 3196 var browser = navigator.userAgent.toLowerCase(); 3197 var os = navigator.appVersion.toLowerCase(); 3198 3199 if (browser.indexOf('firefox') > -1 && os.indexOf("mac") > -1) { 3200 $('body').addClass('firefox_mac_browser'); 3201 } 3202} 3203 3204/* 3205** Initialize Qode search form 3206*/ 3207function initSearchButton(){ 3208 if($('.search_button').length){ 3209 $('.search_button').click(function(e){ 3210 e.preventDefault(); 3211 3212 if($('html').hasClass('touch')){ 3213 if ($('.qode_search_form').height() == "0") { 3214 $('.qode_search_form input[type="text"]').onfocus = function () { 3215 window.scrollTo(0, 0); 3216 document.body.scrollTop = 0; 3217 }; 3218 $('.qode_search_form input[type="text"]').onclick = function () { 3219 window.scrollTo(0, 0); 3220 document.body.scrollTop = 0; 3221 }; 3222 $('.header_top_bottom_holder').css('top','50px'); 3223 $('.qode_search_form').css('height','50px'); 3224 $('.content_inner').css('margin-top','50px'); 3225 if($scroll < 34){ $('header.page_header').css('top','0'); } 3226 } else { 3227 $('.qode_search_form').css('height','0'); 3228 $('.header_top_bottom_holder').css('top','0'); 3229 $('.content_inner').css('margin-top','0'); 3230 if($scroll < 34){ $('header.page_header').css('top',-$scroll);} 3231 } 3232 3233 $(window).scroll(function() { 3234 if ($('.qode_search_form').height() != "0" && $scroll > 50) { 3235 $('.qode_search_form').css('height','0'); 3236 $('.header_top_bottom_holder').css('top','0'); 3237 $('.content_inner').css('margin-top','0'); 3238 } 3239 }); 3240 3241 $('.qode_search_close').click(function(e){
3242 e.preventDefault(); 3243 $('.qode_search_form').css('height','0'); 3244 $('.header_top_bottom_holder').css('top','0'); 3245 $('.content_inner').css('margin-top','0'); 3246 if($scroll < 34){ $('header.page_header').css('top',-$scroll);} 3247 }); 3248 3249 } else { 3250 if($('.title').hasClass('has_fixed_background')){ 3251 var yPos = parseInt($('.title.has_fixed_background').css('backgroundPosition').split(" ")[1]); 3252 }else { 3253 var yPos = 0; 3254 } 3255 if ($('.qode_search_form').height() == "0") { 3256 $('.qode_search_form input[type="text"]').focus(); 3257 $('.header_top_bottom_holder').stop().animate({top:"50px"},150); 3258 $('.qode_search_form').stop().animate({height:"50px"},150); 3259 $('.content_inner').stop().animate({marginTop:"50px"},150); 3260 if($scroll < 34){ $('header.page_header').stop().animate({top:0},150); } 3261 $('.title.has_fixed_background').animate({ 3262 'background-position-y': (yPos + 50)+'px' 3263 }, 150); 3264 } else { 3265 $('.qode_search_form').stop().animate({height:"0"},150); 3266 $('.header_top_bottom_holder').stop().animate({top:"0px"},150); 3267 $('.content_inner').stop().animate({marginTop:"0"},150); 3268 if($scroll < 34){ $('header.page_header').stop().animate({top:-$scroll},150);} 3269 $('.title.has_fixed_background').animate({ 3270 'background-position-y': (yPos - 50)+'px' 3271 }, 150); 3272 } 3273 3274 $(window).scroll(function() { 3275 if ($('.qode_search_form').height() != "0" && $scroll > 50) { 3276 $('.qode_search_form').stop().animate({height:"0"},150); 3277 $('.header_top_bottom_holder').stop().animate({top:"0px"},150); 3278 $('.content_inner').stop().animate({marginTop:"0"},150); 3279 $('.title.has_fixed_background').css('backgroundPosition', 'center '+(yPos)+'px'); 3280 } 3281 }); 3282 3283 $('.qode_search_close').click(function(e){ 3284 e.preventDefault(); 3285 $('.qode_search_form').stop().animate({height:"0"},150); 3286 $('.content_inner').stop().animate({marginTop:"0"},150); 3287 $('.header_top_bottom_holder').stop().animate({top:"0px"},150); 3288 if($scroll < 34){ $('header.page_header').stop().animate({top:-$scroll},150);} 3289 $('.title.has_fixed_background').animate({ 3290 'background-position-y': (yPos)+'px' 3291 }, 150); 3292 }); 3293 } 3294 }); 3295 } 3296} 3297 3298/* 3299** Init update Shopping Cart 3300*/ 3301function updateShoppingCart(){ 3302 "use strict"; 3303 3304 $('body').bind('added_to_cart', add_to_cart); 3305 function add_to_cart(event, parts, hash) { 3306 var miniCart = $('.shopping_cart_header'); 3307 if ( parts['div.widget_shopping_cart_content'] ) { 3308 var $cartContent = jQuery(parts['div.widget_shopping_cart_content']), 3309 $itemsList = $cartContent .find('.cart_list'), 3310 $total = $cartContent.find('.total').contents(':not(strong)').text(); 3311 miniCart.find('.shopping_cart_dropdown_inner').html('').append($itemsList); 3312 miniCart.find('.total span').html('').append($total); 3313 } 3314 } 3315} 3316 3317/* 3318** Set content bottom margin because of the uncovering footer 3319*/ 3320function setContentBottomMargin(){ 3321 if($('.uncover').length){ 3322 $('.content').css('margin-bottom', $('footer').height()); 3323 } 3324} 3325 3326/* 3327 ** Set footer uncover with vertical area 3328 */ 3329function footerWidth(){ 3330 "use strict"; 3331 3332 if($('.uncover').length && $('body').hasClass('vertical_menu_enabled') && $window_width > 1000){ 3333 $('.uncover').width($window_width - $('.vertical_menu_area').width()); 3334 } else{ 3335 $('.uncover').css('width','100%'); 3336 } 3337} 3338 3339/* 3340 ** Init footer height for left border line 3341 */ 3342function setFooterHeight(){ 3343 "use strict"; 3344 3345 if($window_width > 600){ 3346 $('.footer_top > div').innerHeight(); 3347 $(".footer_top .qode_column").css('min-height', 0).css('min-height', $('.footer_top > div').innerHeight()); 3348 } 3349} 3350 3351/* 3352** Boxes which reveal text on hover 3353*/ 3354function initCoverBoxes(){ 3355 if($('.cover_boxes').length) { 3356 $('.cover_boxes').each(function(){ 3357 var active_element = 0; 3358 var data_active_element = 1; 3359 if(typeof $(this).data('active-element') !== 'undefined' && $(this).data('active-element') !== false) { 3360 data_active_element = parseFloat($(this).data('active-element')); 3361 active_element = data_active_element - 1; 3362 } 3363 3364 var number_of_columns = 3; 3365 3366 //validate active element 3367 active_element = data_active_element > number_of_columns ? 0 : active_element; 3368 3369 $(this).find('li').eq(active_element).addClass('act'); 3370 var cover_boxed = $(this); 3371 $(this).find('li').each(function(){ 3372 $(this).hover(function() { 3373 $(cover_boxed).find('li').removeClass('act'); 3374 $(this).addClass('act'); 3375 }); 3376 3377 }); 3378 }); 3379 } 3380} 3381 3382function initButtonHover() { 3383 "use strict"; 3384 3385 if($('.qbutton').length) { 3386 $('.qbutton').each(function() { 3387 3388 //hover background color 3389 if(typeof $(this).data('hover-background-color') !== 'undefined' && $(this).data('hover-background-color') !== false) { 3390 var hover_background_color = $(this).data('hover-background-color'); 3391 var initial_background_color = $(this).css('background-color'); 3392 $(this).hover( 3393 function() { 3394 $(this).css('background-color', hover_background_color); 3395 }, 3396 function() { 3397 $(this).css('background-color', initial_background_color); 3398 }); 3399 } 3400 3401 //hover border color 3402 if(typeof $(this).data('hover-border-color') !== 'undefined' && $(this).data('hover-border-color') !== false) { 3403 var hover_border_color = $(this).data('hover-border-color'); 3404 var initial_border_color = $(this).css('border-top-color'); 3405 $(this).hover( 3406 function() { 3407 $(this).css('border-color', hover_border_color); 3408 }, 3409 function() { 3410 $(this).css('border-color', initial_border_color); 3411 }); 3412 } 3413 3414 //hover color 3415 if(typeof $(this).data('hover-color') !== 'undefined' && $(this).data('hover-color') !== false) { 3416 var hover_color = $(this).data('hover-color'); 3417 var initial_color = $(this).css('color'); 3418 $(this).hover( 3419 function() { 3420 $(this).css('color', hover_color); 3421 }, 3422 function() { 3423 $(this).css('color', initial_color); 3424 }); 3425 } 3426 }); 3427 } 3428} 3429 3430function initSocialIconHover() 3431{ 3432 // removed all code here - it was unnecessary (MVMVMVMV) 3433} 3434 3435/* 3436 ** Popup menu initialization 3437 */ 3438function initPopupMenu(){ 3439 "use strict"; 3440 3441 if($('a.popup_menu').length){ 3442 //var body_top; 3443 3444 //set height of popup holder and initialize nicescroll 3445 $(".popup_menu_holder_outer").height($window_height).niceScroll({ 3446 scrollspeed: 30, 3447 mousescrollstep: 20, 3448 cursorwidth: 0, 3449 cursorborder: 0,
3450 cursorborderradius: 0, 3451 cursorcolor: "transparent", 3452 autohidemode: false, 3453 horizrailenabled: false 3454 }); //200 is top and bottom padding of holder 3455 3456 //set height of popup holder on resize 3457 $(window).resize(function() { 3458 $(".popup_menu_holder_outer").height($window_height); 3459 }); 3460 3461 // Open popup menu 3462 $('a.popup_menu').on('click',function(e){ 3463 e.preventDefault(); 3464 3465 if(!$(this).hasClass('opened')){ 3466 $(this).addClass('opened'); 3467 $('body').addClass('popup_menu_opened'); 3468 setTimeout(function(){ 3469 if(!$('body').hasClass('page-template-full_screen-php')){ 3470 $('body').css('overflow','hidden'); 3471 } 3472 },400); 3473 }else{ 3474 $(this).removeClass('opened'); 3475 $('body').removeClass('popup_menu_opened'); 3476 3477 setTimeout(function(){ 3478 if(!$('body').hasClass('page-template-full_screen-php')){ 3479 $('body').css('overflow','visible'); 3480 } 3481 $("nav.popup_menu ul.sub_menu").slideUp(200, function(){ 3482 $('nav.popup_menu').getNiceScroll().resize(); 3483 }); 3484 },400); 3485 3486 } 3487 }); 3488 3489 //logic for open sub menus in popup menu 3490 $(".popup_menu > ul > li.has_sub > a, .popup_menu > ul > li.has_sub > h6").on('tap click', function (e) { 3491 e.preventDefault(); 3492 3493 if ($(this).closest('li.has_sub').find("> ul.sub_menu").is(":visible")){ 3494 $(this).closest('li.has_sub').find("> ul.sub_menu").slideUp(200, function(){ 3495 $('.popup_menu_holder_outer').getNiceScroll().resize(); 3496 }); 3497 $(this).closest('li.has_sub').removeClass('open_sub'); 3498 } else { 3499 $(this).closest('li.has_sub').addClass('open_sub'); 3500 $(this).closest('li.has_sub').find("> ul.sub_menu").slideDown(200, function(){ 3501 $('.popup_menu_holder_outer').getNiceScroll().resize(); 3502 }); 3503 } 3504 3505 return false; 3506 }); 3507 3508 //if link has no submenu and if it's not dead, than open that link 3509 $(".popup_menu ul li:not(.has_sub) a").click(function () { 3510 if(($(this).attr('href') !== "http://#") && ($(this).attr('href') !== "#")){ 3511 $('a.popup_menu').removeClass('opened'); 3512 $('body').removeClass('popup_menu_opened').css('overflow','visible'); 3513 $("nav.popup_menu ul.sub_menu").slideUp(200, function(){ 3514 $('nav.popup_menu').getNiceScroll().resize(); 3515 }); 3516 }else{ 3517 return false; 3518 } 3519 }); 3520 } 3521} 3522 3523/* 3524 ** Image Gallery Slider with no space initialization 3525 */ 3526function initImageGallerySliderNoSpace(){ 3527 "use strict"; 3528 3529 if($('.qode_image_gallery_no_space').length){ 3530 $('.qode_image_gallery_no_space').each(function(){ 3531 $(this).animate({'opacity': 1},1000); 3532 $(this).find('.qode_image_gallery_holder').lemmonSlider({infinite: true}); 3533 }); 3534 3535 //disable click on non active image 3536 $('.qode_image_gallery_no_space').on('click', 'li:not(.active) a', function() { 3537 return false; 3538 }); 3539 } 3540} 3541 3542function initFullScreenTemplate(){ 3543 "use strict"; 3544 3545 if($('.full_screen_section_slide').length){ 3546 $('.full_screen_section_slide').closest('.full_screen_section').addClass('full_screen_section_slides'); 3547 } 3548 3549 if($('.full_screen_holder').length && $window_width > 600){ 3550 3551 $('.full_screen_preloader').css('height', ($window_height)); 3552 3553 $('#up_fs_button').on('click', function() { 3554 $.fn.fullpage.moveSectionUp(); 3555 return false; 3556 }); 3557 3558 $('#down_fs_button').on('click', function() { 3559 $.fn.fullpage.moveSectionDown(); 3560 return false; 3561 }); 3562 3563 var $header_height = 0; 3564 if($('header.page_header').length){ 3565 if($window_width > 1400){ 3566 $header_height = $('header.page_header').height() + 45; //45 is default distance 3567 } else { 3568 $header_height = $('header.page_header').height() + 10; //10 is distance for responsive 3569 } 3570 } 3571 3572 $('.full_screen_navigation_holder.up_arrow').css('top',$header_height); 3573 3574 var section_number = $('.full_screen_inner > .full_screen_section').length; 3575 $('.full_screen_inner').fullpage({ 3576 sectionSelector: '.full_screen_section', 3577 slideSelector: '.full_screen_section_slide', 3578 scrollOverflow: true, 3579 afterLoad: function(anchorLink, index){ 3580 checkActiveArrowsOnFullScrrenTemplate(section_number, index); 3581 }, 3582 afterRender: function(){ 3583 checkActiveArrowsOnFullScrrenTemplate(section_number, 1); 3584 $('.full_screen_holder').find('.full_screen_navigation_holder').css('visibility','visible'); 3585 $('.full_screen_holder').find('.full_screen_inner').css('visibility','visible'); 3586 $('.full_screen_preloader').hide(); 3587 if($('.full_screen_holder video.full_screen_sections_video').length){ 3588 $('.full_screen_holder video.full_screen_sections_video').each(function(){ 3589 $(this).get(0).play(); 3590 }); 3591 } 3592 } 3593 }); 3594 } 3595} 3596 3597function checkActiveArrowsOnFullScrrenTemplate(section_number, index){ 3598 "use strict"; 3599 3600 if(index == '1'){ 3601 $('.full_screen_navigation_holder.up_arrow').hide(); 3602 $('.full_screen_navigation_holder.down_arrow').hide(); 3603 if(index != section_number){
3604 $('.full_screen_navigation_holder.down_arrow').show(); 3605 } 3606 }else if(index == section_number){ 3607 $('.full_screen_navigation_holder.down_arrow').hide(); 3608 if(section_number == '2'){ 3609 $('.full_screen_navigation_holder.up_arrow').show(); 3610 } 3611 }else{ 3612 $('.full_screen_navigation_holder.up_arrow').show(); 3613 $('.full_screen_navigation_holder.down_arrow').show(); 3614 } 3615}
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.