1/** 2 Fortuna Common JS functionaly 3**/ 4 5 6// Global Vars 7var boc_is_mobile = (bocJSParams.boc_is_mobile_device) ? true : false; 8var boc_theme_url = bocJSParams.boc_theme_url; 9var boc_default_empty_image = boc_theme_url+"/images/no_img.jpg"; 10var sticky_header = (bocJSParams.sticky_header =='0')?false:true; 11var transparent_header = (bocJSParams.transparent_header =='0')?false:true; 12var fixed_footer = (bocJSParams.fixed_footer =='0')?false:true; 13var submenu_arrow_effect = (bocJSParams.submenu_arrow_effect =='0')?false:true; 14var mm_bordered_columns = (bocJSParams.mm_bordered_columns =='0')?false:true; 15var boc_woo_lightbox_enabled = (bocJSParams.boc_woo_lightbox_enabled =='0')?false:true; 16var boc_submenu_animation_effect = bocJSParams.boc_submenu_animation_effect; 17 18jQuery(document).ready(function($){ 19 20 var header_h = $('#header').height(); 21 var win_width = getWindowWidth(); 22 23 // If an error with an Image occurs default it to an existing empty image 24 var img = $('img'); 25 img.error(function() { 26 $(this).attr('src', boc_default_empty_image); 27 }); 28 29 if(boc_is_mobile){ 30 // IF Header is transparent pull content up and remove it 31 if((jQuery('#header').boc_doesExist()) && ($('#header').hasClass('transparent_header'))){ 32 $('#header').removeClass('transparent_header'); 33 // $('.content_body').css('top', -header_h + 'px'); 34 } 35 $('#header').addClass('mobile_force_relative_position'); 36 $('#footer').addClass('mobile_force_relative_position'); 37 } 38 // Push down content 39 if(sticky_header && (jQuery('#header').boc_doesExist()) && !transparent_header && !boc_is_mobile){ 40 if(win_width >= 1018){ 41 $('.content_body').css('marginTop', header_h + 'px'); 42 } 43 } 44 45 //KG added scroller 46 $('a[href^="#"]').on('click', function(event) { 47 var target = $( $(this).attr('href') ); 48 if( target.length ) { 49 event.preventDefault(); 50 $('html, body').animate({ 51 scrollTop: (target.offset().top-140) 52 }, 1000); 53 } 54 }); 55 56 $(window).smartresize(function() { 57 var win_width = getWindowWidth(); 58 if(win_width >= 1018){ 59 $('#mobile_menu').css('display', 'none'); 60 if($('#mobile_menu_toggler').hasClass('active_mobile_menu')){ 61 $('#mobile_menu_toggler').removeClass('active_mobile_menu'); 62 $('.m_nav_ham').removeClass('m_nav_menu').addClass('button_closed'); 63 $("#m_ham_1").removeClass("m_nav_ham_1_open"); 64 $("#m_ham_2").removeClass("m_nav_ham_2_open"); 65 $("#m_ham_3").removeClass("m_nav_ham_3_open"); 66 } 67 } 68 }); 69 70 71 // Comment Button add Classes 72 $('#commentform input#submit').addClass('button btn_theme_color btn_rounded'); 73 74 75 // Search in Header 76 $('.boc_search_toggle_li a').click(function(){ 77 $('#boc_searchform_in_header').fadeToggle(200); 78 $('#boc_searchform_in_header').toggleClass('activated'); 79 $('#boc_searchform_in_header input').focus(); 80 }); 81 $('#boc_searchform_close').click(function(){ 82 $('#boc_searchform_in_header').fadeToggle(200); 83 $('#boc_searchform_in_header').toggleClass('activated'); 84 }); 85 // Close forms 86 $('#boc_searchform_in_header, .boc_search_toggle_li').click(function( event ) { 87 event.stopPropagation(); 88 }); 89 $(document).click( function(){ 90 $('#boc_searchform_in_header').removeClass('activated').fadeOut(200); 91 }); 92 93 $('.boc_search_toggle_li a').click(function(e){ 94 e.preventDefault(); 95 }); 96 // Search in Header :: END 97 98 99 // Sidebar Menu 100 $('#sidebar .widget_categories > ul, #sidebar .widget_nav_menu > div > ul, #sidebar .widget_pages ul:first, #sidebar .widget_meta ul, #sidebar .widget_recent_entries ul, #sidebar ul.product-categories, .wpb_widgetised_column .widget_categories > ul').addClass('side_bar_menu'); 101 102 $('#sidebar ul.side_bar_menu a, .wpb_widgetised_column ul.side_bar_menu a').wrapInner('<span class="link_span"/>').prepend('<span class="hover_span"></span>'); 103 104 // Sidebar Menu effects 105 $('.side_bar_menu a').not(".active").hover( 106 function() { 107 $(this).children('.hover_span').stop().animate({width:'100%'},500,'easeOutExpo'); 108 }, 109 function() { 110 $(this).children('.hover_span').stop().animate({width:'0'},200,'easeOutExpo'); 111 } 112 ); 113 114 // Sidebar Nav effects 115 $('.side_bar_nav a').not(".active").hover( 116 function() { 117 $(this).children('.hover_span').stop().animate({width:'100%'},500,'easeOutExpo'); 118 }, 119 function() { 120 $(this).children('.hover_span').stop().animate({width:'0'},200,'easeOutExpo'); 121 } 122 ); 123 124 $('.testimonials').parents('.textwidget').css('paddingBottom',0); 125 126 // Top Comment class
127 $('.single_comment:first').addClass('first_comment'); 128 129 // Footer Navigation pushoff 130 $('#footer .menu').addClass('margined_left'); 131 $('#footer .menu').parent().prev('h3').addClass('margined_left'); 132 133 134 // Sidebar Nav effects 135 $('.side_bar_nav a').not(".active").hover( 136 function() { 137 $(this).children('.hover_span').stop().animate({width:'100%'},500,'easeOutExpo'); 138 }, 139 function() { 140 $(this).children('.hover_span').stop().animate({width:'0'},200,'easeOutExpo'); 141 } 142 ); 143 144 // TABS 145 // First we build the tabs 146 $('.resp-tabs-container .single_tab_div').each(function(){ 147 var title = $(this).attr('rel-title'); 148 // Replace spaces with dashes for ID 149 var title_id = title.replace(/\s+/g, '-').toLowerCase(); 150 var icon = $(this).attr('rel-icon'); 151 var icon_html = (icon!=='') ? "<span class='"+ icon +"'></span> " : ''; 152 $(this).parent('.resp-tabs-container').prev('ul.resp-tabs-list').append('<li id="'+ title_id +'">'+ icon_html + title +'</li>'); 153 }); 154 155 $('.newtabs').each(function(){ 156 var type = $(this).hasClass("vertical")? "vertical" : "horizontal"; 157 $(this).easyResponsiveTabs({ 158 type: type, 159 width: 'auto', 160 fit: true, 161 activate: function(e) { 162 //console.log($(e.target).attr("aria-controls")); 163 }, 164 }); 165 $(this).animate({opacity: 1},200); 166 167 // Check for page's hashtag, if it matches - click the tab 168 if(window.location.hash) { 169 var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character 170 $(this).find(':first-child').children(".resp-tab-item").each(function(){ 171 if($(this).attr("id") == hash) { 172 $(this).click(); 173 } 174 }); 175 } 176 }); 177 178 179 /* Accordions */ 180 $(".accordion").click(function(){ 181 182 // Do we toggle siblings 183 var no_sibling_toggle = $(this).parent('.acc_item').parent('.acc_holder').hasClass('no_sibling_toggle'); 184 if(!no_sibling_toggle){ 185 $(this).parent('.acc_item').siblings().children(".accordion_content").not($(this).siblings(".accordion_content")).slideUp(400,'easeInOutExpo'); 186 $(this).parent('.acc_item').siblings().children(".accordion").not($(this)).removeClass("active_acc"); 187 } 188 $(this).next(".accordion_content").slideToggle(800,'easeInOutExpo'); 189 190 if($(this).hasClass('active_acc')){ 191 $(this).removeClass("active_acc"); 192 }else{ 193 $(this).addClass("active_acc"); 194 } 195 }); 196 197 // Open Active accordion item when scrolled to 198 window.setTimeout(function(){ 199 $('.acc_is_open').waypoint(function () { 200 if(!$(this).parent('.accordion').hasClass('active_acc')){ 201 $(this).click(); 202 } 203 }, { offset:'85%',triggerOnce: true }); 204 }, 800); 205 /* Accordions::END */ 206 207 208 /* Info Messages */ 209 $(".closable").each(function(){ 210 $(this).prepend('<a class="close_img icon"></a>'); 211 }); 212 213 $(".close_img").click(function(){ 214 $(this).parent().fadeOut(600); 215 }); 216 217 // If responsive mode is enabled set Variable 218 if($('#wrapper').hasClass('responsive')) { 219 responsive_mode = true; 220 }else { 221 responsive_mode = false;
222 } 223 224 225 // Tooltips 226 $('.tooltipsy').tipsy({fade: true, gravity: 's'}); 227 228 // VC Image links, make em MFP 229 $(".vc_single_image-wrapper").each(function(){ 230 var c = $(this).parent(); 231 if(c.is("a[class='prettyphoto']")) { 232 c.removeClass("prettyphoto"); 233 c.addClass("mfp_popup"); 234 } 235 }); 236 237 238 // Magnific Popup Items 239 $("a.mfp_popup").magnificPopup({ 240 type:'image', 241 mainClass: 'boc_popup_spin', 242 removalDelay: 200, 243 fixedContentPos: false, 244 }); 245 $(".mfp_gallery").each(function() { 246 $(this).magnificPopup({ 247 delegate: "a.mfp_popup_gal", 248 type:'image', 249 gallery:{ 250 enabled: true 251 }, 252 mainClass: 'boc_popup_spin', 253 removalDelay: 200, 254 fixedContentPos: false, 255 }); 256 }); 257 258 // For Videos, GMaps 259 $("a.mfp_iframe_popup, .wpb_single_image.mfp_iframe_popup a").magnificPopup({ 260 type:'iframe', 261 mainClass: 'boc_popup_spin', 262 removalDelay: 200, 263 fixedContentPos: false, 264 }); 265 266 267 // WooCommerce product page custom gallery 268 if(boc_woo_lightbox_enabled) { 269 $(".boc_single_product .images").each(function() { 270 $(this).magnificPopup({ 271 delegate: "a", 272 type:'image', 273 gallery:{ 274 enabled: true 275 }, 276 mainClass: 'boc_popup_spin', 277 removalDelay: 200, 278 fixedContentPos: false, 279 }); 280 }); 281 } 282 283 284 285 // Animate icons fading 286 $('#subheader a.header_soc_icon').hover( 287 function() { 288 $(this).siblings('a').stop().fadeTo(100, 0.5); 289 $(this).stop().fadeTo(100, 1); 290 }, 291 function() { 292 $(this).siblings('a').stop().fadeTo(100, 0.9); 293 $(this).stop().fadeTo(100, 0.9); 294 } 295 ); 296 297 // Animate icons fading 298 $('.footer_soc_icon').hover( 299 function() { 300 $(this).siblings('a').stop().fadeTo(100, 0.35); 301 }, 302 function() { 303 $(this).siblings('a').stop().fadeTo(100, 1); 304 } 305 ); 306 307 // Resize Videos to Inherit parent width 308 $(function() { 309 310 var $allVideos = $("iframe[src^='http://player.vimeo.com'], iframe[src^='https://player.vimeo.com'], iframe[src^='//player.vimeo.com'], iframe[src^='http://www.youtube.com'], iframe[src^='https://www.youtube.com'], iframe[src^='//www.youtube.com'], object, embed").not('.rev_slider iframe'); 311 312 $allVideos.each(function() { 313 $(this) 314 // $ .data does not work on object/embed elements 315 .attr('data-aspectRatio', this.height / this.width) 316 .removeAttr('height') 317 .removeAttr('width'); 318 }); 319 320 $(window).smartresize(function() { 321 $allVideos.each(function() { 322 var nWidth = $(this).parent().width(); 323 $(this).width(nWidth).height(nWidth * $(this).attr('data-aspectRatio')); 324 }); 325 }).resize(); 326 }); 327 328 329 // Equal Height Columns 330 $('.equal_height_column').matchHeight(); 331 332 // Vertically Align Content in Columns 333 $(".align_middle_column.wpb_column > .wpb_wrapper").verticalAlignMiddle(); 334 335 336 // Custom BOC Waypoints 337 338 // Bar graph 339 $('.bar_graph.boc_animate_when_almost_visible_custom_start:not(.boc_start_animation)').waypoint(function () { 340 var b_width = $(this).find("span").attr("data-width"); 341 $(this).addClass('boc_start_animation'); 342 $(this).find("span").animate({width: b_width+"%"},2000,"easeOutCubic"); 343 $(this).find("span strong").animate({opacity: 1},2000,"easeOutCubic"); 344 }, { offset:'85%',triggerOnce: true }); 345 346 347 // Add Delays for specific theme elements 348 349 // Portfolio, Post Items (.info_item, .post_item_block) - for carousels 350 $('.info_block').each(function(i, e) { 351 $(e).find('.info_item.boc_animate_when_almost_visible:not(.boc_start_animation)').each(function (i, e) { 352 var delay = 250; 353 $(e).trans(i * delay + 'ms', '-delay'); 354 }); 355 }); 356 $('.posts_carousel_holder').each(function(i, e) { 357 $(e).find('.post_item_block.boc_animate_when_almost_visible:not(.boc_start_animation)').each(function (i, e) { 358 var delay = 250; 359 $(e).trans(i * delay + 'ms', '-delay'); 360 }); 361 }); 362 363 // Portfolio, Post Items (.info_item) - for grids & portfolio page 364 $('.grid_holder.animated_items').each(function(i, e) { 365 $(e).find('.portfolio_animator_class, .post_item_block').each(function (i, e) { 366 var delay = 250; 367 $(e).trans(i * delay + 'ms', '-delay'); 368 }); 369 }); 370 371 // Show all Portfolio, Post child elements at once for Grids 372 window.setTimeout(function(){
373 $('.grid_holder.animated_items').each(function() { 374 $(this).waypoint(function () { 375 $(this).find('.portfolio_animator_class, .post_item_block').addClass('boc_start_animation'); 376 }, { offset:'85%',triggerOnce: true }); 377 }); 378 }, 300); 379 380 381 // Logo Gallery 382 $('.logo_gallery').each(function (i, e) { 383 var delay = 200; 384 $(e).find(".col").each(function (i, e) { 385 $(e).trans(i * delay + 'ms', '-delay'); 386 }); 387 }); 388 389 390 // Add Delays for Identical elements on a single Row 391 $('.vc_row').each(function(i, e) { 392 393 // Price Columns 394 $(e).find('.price_column.boc_animate_when_almost_visible:not(.boc_start_animation)').each(function (i, e) { 395 var delay = 300; 396 $(e).trans(i * delay + 'ms', '-delay'); 397 }); 398 399 // Person 400 $(e).find('.team_block_content.boc_animate_when_almost_visible:not(.boc_start_animation)').each(function (i, e) { 401 var delay = 300; 402 $(e).trans(i * delay + 'ms', '-delay'); 403 }); 404 405 // Top Icon Box 406 $(e).find('.top_icon_box.boc_animate_when_almost_visible:not(.boc_start_animation)').each(function (i, e) { 407 var delay = 300, 408 stagger = 200 + i*500; 409 410 // Each child 411 $(this).children().each(function (i, e) { 412 413 if(!$(this).is("a")){ 414 $(e).trans(i * delay + stagger + 'ms', '-delay'); 415 }else { 416 $(e).children('.icon_holder').trans(i * delay + stagger + 'ms', '-delay'); 417 } 418 }); 419 }); 420 421 // Side Icon Box 422 $(e).find('.side_icon_box.boc_animate_when_almost_visible:not(.boc_start_animation)').each(function (i, e) { 423 var delay = 150, 424 stagger = 200 + i*300; 425 426 // Each child 427 $(this).children().each(function (i, e) { 428 429 if(!$(this).is("a")){ 430 $(e).trans(i * delay + stagger + 'ms', '-delay'); 431 }else { 432 $(e).children('.icon_holder').trans(i * delay + stagger + 'ms', '-delay'); 433 } 434 }); 435 }); 436 437 // Counters 438 $(e).find('.single_numbers_holder.boc_anim_hidden').each(function (i, e) { 439 440 $(this).waypoint(function () { 441 var delay = 600; 442 setTimeout(function(){ 443 $(e).find(".counter").each(function (i, e) { 444 end_nu = $(e).find(".counter_hidden:first").attr("data-end-nu"); 445 $(e).flipCounter("startAnimation", { end_number: end_nu, duration: 1200 }).find(".counter_desc").addClass("shown"); 446 }); 447 }, i * delay ); 448 $(this).addClass('boc_start_animation'); 449 450 }, { offset:'80%',triggerOnce: true }); 451 }); 452 453 // Circular Counter 454 $(e).find('.circ_numbers_holder').each(function (i, e) { 455 456 $(this).waypoint(function () { 457 var delay = 500; 458 setTimeout(function(){ 459 460 $(e).find(".circ_counter").each(function (i, e) { 461 end_nu = parseInt($(e).find("canvas:first").attr("data-end-nu")); 462 var white_text = $(e).data('white_text'); 463 var size = $(e).data('size'); 464 var angle = ($(e).data('angle') !== '') ? 0 : 0.49; 465 466 var opts = { 467 lines: 1, // The number of lines to draw 468 angle: angle, // The length of each line 469 lineWidth: 0.04, // The line thickness 470 colorStart: $(e).data('color'), 471 colorStop: $(e).data('color'), // just experiment with them 472 strokeColor: (white_text ? "#444444" : "#f5f5f5"), // to see which ones work best for you 473 shadowColor: (white_text ? "#333" : "#eeeeee"), 474 }; 475 476 $(e).find("canvas:first").gauge(opts, end_nu); 477 $(e).find(".counter_percent_sign:first").addClass("shown"); 478 479 }); 480 }, i * delay ); 481 482 }, { offset:'80%', triggerOnce: true }); 483 }); 484 }); 485 486 487 // GLOBAL BOC Waypoints 488 $('.boc_animate_when_almost_visible:not(.boc_start_animation)').waypoint(function () { 489 $(this).addClass('boc_start_animation'); 490 }, { offset:'85%', triggerOnce: true }); 491 492 493 // Create Image Hover effect for Class 494 $('.img_zoom_on_hover').each(function (i, e) { 495 $(e).find("a").each(function (i, e) { 496 $(e).wrap("<div class='pic'></div>"); 497 $(e).find("img").after('<div class="img_overlay"><span class="icon_zoom"></span></div>'); 498 }); 499 }); 500 501 // Create Image Hover effect for products 502 $('.boc_single_product .single_product_left img').each(function (i, e) { 503 $(e).wrap("<div class='pic'></div>").after('<div class="img_overlay"><span class="icon_zoom"></span></div>'); 504 }); 505 $('.woocommerce .products .product img').each(function (i, e) { 506 $(e).wrap("<div class='pic'></div>").after('<div class="img_overlay"><span class="hover_icon icon_plus"></span></div>'); 507 }); 508 509 510 // Rotate words 511 $(".text_rotate").textrotator({ 512 animation: "flipUp", // Options are dissolve (default), fade, flip, flipUp, flipCube, flipCubeUp and spin. 513 separator: ";", 514 speed: 3000 // How many milliseconds until the next word show. 515 }); 516 517 // Typewriter 518 $(".typewriter").each(function(){ 519 var array_texts = ($(this).text().split(";")); 520 $(this).text(""); 521 $(this).waypoint(function() { 522 $(this).animate({ opacity: 1 }); 523 $(this).typed({
524 strings: array_texts, 525 backDelay: 4000, 526 typeSpeed: 80, 527 startDelay: 300, 528 loop: true, 529 loopCount: 1, 530 }); 531 }, { offset:'90%',triggerOnce: true}); 532 }); 533 534 // Text Slider 535 $(".boc_text_slider").each(function(){ 536 537 $(this).waypoint(function() { 538 539 $(this).css({ opacity: 1 }); 540 $(this).boc_text_slider(); 541 542 }, { offset:'90%',triggerOnce: true}); 543 }); 544 545 // Get default logo calculated width 546 preloadImages($("#logo a>img"), function () { 547 $('.logo_img').attr('initital_width', $('#logo a>img').width()); 548 }); 549 550 // Resize Sticky Header + Manage Transparent Logos 551 function headerResize() { 552 var win_width = getWindowWidth(); 553 if(win_width >= 1018){ 554 var window_y = $(window).scrollTop(); 555 556 if(window_y >= (header_h - 20)){ 557 $('#header').addClass('scrolled'); 558 }else { 559 $('#header').removeClass('scrolled'); 560 $( ".logo_img" ).width($('.logo_img').attr('initital_width')); 561 } 562 } 563 } 564 565 // Header resizing 566 if(sticky_header && !boc_is_mobile){ 567 headerResize(); 568 $(window).scroll(function () { 569 headerResize(); 570 }); 571 } 572 573 // Header and footer distance 574 if(!boc_is_mobile){ 575 $(window).smartresize(function() { 576 577 var win_width = getWindowWidth(); 578 if(win_width >= 1018){ 579 if(sticky_header && !transparent_header && (jQuery('#header').boc_doesExist())){ 580 // Since full_header_h will not always be correct if page is scrolled : we take larger than calculated and settings value 581 var full_header_h = Math.max((Number(bocJSParams.header_height) + $('#subheader').parent('.full_header').outerHeight()), $('#header').height()); 582 $('.content_body').css('marginTop', full_header_h + 'px'); 583 } 584 var footer_h = $('#footer').height(); 585 footer_h += 52; 586 587 if(fixed_footer && (jQuery('#footer').boc_doesExist())){ 588 $('.content_body').css('marginBottom', footer_h + 'px'); 589 } 590 }else { 591 $('.content_body').css('marginTop', 0); 592 $('.content_body').css('marginBottom', 0); 593 } 594 }); 595 } 596 597 598 // Hide Preloader if it is set 599 if ($('#boc_page_preloader').boc_doesExist()){ 600 $(window).load(function(){ 601 boc_hide_page_preloader(); 602 }); 603 } 604 605 606 /* ----------- WooCommerce Cart ------------ */ 607 608 var notification_timeout; 609 var productData; 610 611 // Add top padding to product page if there's no pageheading 612 if(!$('.full_container_page_title').boc_doesExist()) { 613 $('.boc_single_product').animate({paddingTop: 40},500); 614 } 615 616 // Feed Product name to notification 617 $('.woocommerce .product .add_to_cart_button').click(function(){ 618 productData = $(this).parents('li').find('h3').text(); 619 $('.header_cart .cart-notification span.item-name').html(productData); 620 }); 621 622 // Notification 623 $('.header_cart .cart-notification').hover(function(){ 624 $(this).fadeOut(400); 625 $('.header_cart .widget_shopping_cart').stop(true,true).fadeIn(400); 626 $('.header_cart .cart_list').stop(true,true).fadeIn(400); 627 clearTimeout(notification_timeout); 628 }); 629 630 // Header cart 631 $('.header_cart').hover(function(){ 632 var win_width = getWindowWidth(); 633 if(win_width >= 1018){ 634 $('.header_cart .widget_shopping_cart').stop(true,true).fadeIn(400); 635 $('.header_cart .cart_list').stop(true,true).fadeIn(400); 636 clearTimeout(notification_timeout); 637 $('.header_cart .cart-notification').fadeOut(300); 638 } 639 },function(e){ 640 $('.header_cart .widget_shopping_cart').stop(true,true).fadeOut(300); 641 $('.header_cart .cart_list').stop(true,true).fadeOut(300); 642 }); 643 644 645 $('body').bind('added_to_cart', shopping_cart_notification_show); 646 $('body').bind('added_to_cart', shopping_cart_dropdown); 647 648 649 function shopping_cart_dropdown() { 650 651 if(!$('.header_cart .widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.header_cart .widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 ) { 652 653 $('.header_cart').removeClass('is_empty').addClass('is_not_empty'); 654 655 }else { 656 $('.header_cart').addClass('is_empty').removeClass('is_not_empty'); 657 } 658 } 659 660 function shopping_cart_notification_show(e) { 661 662 clearTimeout(notification_timeout); 663 664 if(!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && typeof e.type != 'undefined' ) { 665 666 setTimeout(function(){ $('.header_cart .cart-notification').fadeIn(400); },200); 667 notification_timeout = setTimeout(hide_notification,3000); 668 } 669 } 670 671 function hide_notification() { 672 $('.header_cart .cart-notification').stop(true,true).fadeOut(); 673 } 674 675 676 677 /* ----------- WooCommerce Cart :: END ------------ */ 678 679 680 // Smoothscroll for Single Page 681 smoothScroll.init({ 682 selector: '[rel="smooth_scroll"]', 683 selectorHeader: '#header.sticky_header', // Selector for fixed headers 684 speed: 500, 685 easing: 'easeInOutQuart', 686 updateURL: false, 687 offset: 0, 688 }); 689 // Crawl all smooth_scrolls and match with current page, remove if not linking to current page 690 if($('a[rel="smooth_scroll"]').boc_doesExist()){ 691 var boc_loc = window.location.href.split('#')[0]; 692 $('a[rel="smooth_scroll"]').each(function() { 693 if (boc_loc != $(this).attr("href").split('#')[0]) { 694 $(this).removeAttr("rel"); 695 } 696 }); 697 } 698 // If a hash exists in URL, scroll to it 699 if ( window.location.hash ) { 700 var options = {
701 speed: 800, 702 easing: 'easeInOutQuart', 703 }; 704 smoothScroll.animateScroll( null, window.location.hash, options ); 705 } 706 707 708 // Tilted images 709 if($('.tilting_img').boc_doesExist() && !boc_is_mobile){ 710 $('.tilting_img').each(function() { 711 var img = $(this).find('img').first(); 712 // Set parent dimensions 713 img.parent(".vc_single_image-wrapper").css({ 714 "width": img.width(), 715 "height": img.height(), 716 }); 717 opts = { 718 "extraImgs" : 6, 719 "opacity" : 0.7, 720 "bgfixed" : true, 721 "movement": { 722 "perspective" : 1000, 723 "translateX" : -10, 724 "translateY" : -10, 725 "translateZ" : 20, 726 "rotateX" : 3, 727 "rotateY" : 5 728 }}; 729 730 new TiltFx(img[0], opts); 731 }); 732 } 733 734 735 // Row Tilting BGR 736 if($('.vc_row.row_tilting_bgr').boc_doesExist() && !boc_is_mobile){ 737 738 // Let's do it after load as stretched Rows are calculated then 739 $(window).load(function(){ 740 741 $('.vc_row.row_tilting_bgr').each(function() { 742 var bgr_url = $(this).attr("data-vc-parallax-image"); 743 744 if($(this).hasClass("disable_pointer_events")){ 745 $(this).find(".wpb_column").css("pointer-events","none"); 746 } 747 $(this).prepend($("<img>").attr("src",bgr_url).css({ 748 "position" : "absolute", 749 "top" : "50%", 750 "left" : 0, 751 "transform" : "translateY(-50%)", 752 })); 753 var img = $(this).find('img').first(); 754 img.wrap("<div class='row_tilting_bgr_img_wrapper'></div>"); 755 756 // Set parent dimensions 757 img.parent(".row_tilting_bgr_img_wrapper").css({ 758 "width": $(this).css("width"), 759 "height": $(this).css("height"), 760 "position" : "absolute", 761 "top" : "50%", 762 "left" : 0, 763 "transform" : "translateY(-50%)", 764 }); 765 opts = { 766 "extraImgs" : 6, 767 "opacity" : 0.6, 768 "bgfixed" : false, 769 "movement": { 770 "perspective" : 1500, 771 "translateX" : -4, 772 "translateY" : -4, 773 "translateZ" : 8, 774 "rotateX" : 5, 775 "rotateY" : 5 776 }}; 777 778 new TiltFx(img[0], opts); 779 }); 780 }); 781 } 782 783 784 // Push header down for admin bar 785 $(window).smartresize(function() { 786 pushHeaderAdminBar(); 787 }); 788 789}); 790 791 792 793// Isotope Grid 794jQuery(window).load(function(){ 795 jQuery(function($){ 796 797 $(".grid_holder").each( function(i, e){ 798 799 // If found in Tabs, do not isotope 800 if (! $(e).parents('.newtabs').boc_doesExist()) { 801 802 var $container = $(e); 803 $container.isotope(); 804 805 $(window).smartresize( function() { 806 setTimeout(function() { 807 $container.isotope(); 808 },400); 809 }); 810 811 var $optionLinks = $container.prev().find(".grid_filter_inline").find("li div"); 812 813 $optionLinks.click(function(){ 814 var selector = $(this).attr("data-option-value"); 815 $container.isotope({ filter: selector }); 816 $container.prev().find(".grid_filter_inline li div").removeClass("current_portfolio_item"); 817 $(this).addClass("current_portfolio_item"); 818 819 return false; 820 }); 821 } 822 }); 823 }); 824}); 825 826 827// Check if element(s) exist 828jQuery.fn.boc_doesExist = function(){ 829 return jQuery(this).length > 0; 830}; 831 832 833/* Hide Preloader function */ 834function boc_hide_page_preloader(){ 835 836 jQuery('#boc_page_preloader').css('opacity', 0); 837 setTimeout(function(){ 838 jQuery('#boc_page_preloader').hide(); 839 }, 500); 840} 841 842 843//On Page load calculate header spacing for admin bar 844jQuery(window).load(function(){ 845 pushHeaderAdminBar(); 846}); 847 848 849// Custom WindowWidth method, will use instead of $(window).width() cuz scroll messes it up 850function getWindowWidth() { 851 return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 852} 853 854 855function pushHeaderAdminBar() { 856 var wp_adm_h = jQuery('#wpadminbar').height(); 857 if(sticky_header && !boc_is_mobile){ 858 var win_width = getWindowWidth(); 859 if(win_width >= 1018){ 860 if(jQuery('#wpadminbar').boc_doesExist()) { 861 jQuery('#header').css('marginTop', wp_adm_h + 'px'); 862 //console.log(win_width); 863 } 864 }else { 865 jQuery('#header').css('marginTop', 0); 866 } 867 }else if(transparent_header && !boc_is_mobile) { 868 jQuery('#header.transparent_header').css('marginTop', wp_adm_h + 'px'); 869 } 870} 871 872//On Page load calculate footer spacing 873if(!boc_is_mobile){ 874 if(jQuery('#footer').boc_doesExist()){ 875 jQuery(window).load(function(){ 876 var win_width = getWindowWidth(); 877 if(win_width >= 1018){ 878 var footer_h = jQuery('#footer').height(); 879 footer_h += 52; 880 if(fixed_footer){ 881 jQuery('.content_body').css('marginBottom', footer_h + 'px'); 882 } 883 }else { 884 jQuery('.content_body').css('marginBottom', 0); 885 } 886 }); 887 } 888} 889 890// For Animation transitions 891jQuery.fn.trans = function () { 892 var t = arguments[0], 893 d = arguments[1] || ''; 894 if (t) { 895 jQuery.each(this, function (i, e) { 896 jQuery(['-webkit-', '-moz-', '-o-', '-ms-', '']).each(function (i, p) { 897 jQuery(e).css(p + 'transition' + d, t); 898 }); 899 }); 900 } 901}; 902 903function preloadImages(imgs, callback) { 904 905 var cache = [], 906 imgsTotal = imgs.length, 907 imgsLoaded = 0; 908 909 // If IE start off animations right away 910 var ua = window.navigator.userAgent; 911 var msie = ua.indexOf('MSIE '); 912 var trident = ua.indexOf('Trident/'); 913 914 if (msie > 0) { 915 // IE 10 or older => return version number 916 callback(); 917 } 918 919 if (trident > 0) { 920 // IE 11 (or newer) => return version number 921 callback(); 922 } 923 924 if(jQuery(imgs).length){ 925 jQuery(imgs).each(function (i, img) { 926 var cacheImage = document.createElement('img'); 927 928 cacheImage.onload = function () { 929 if (++imgsLoaded == imgsTotal) callback(); 930 }; 931 cacheImage.src = jQuery(img).attr('src'); 932 933 cache.push(cacheImage); 934 }); 935 }else { 936 callback(); 937 } 938} 939 940 941function mobile_menu_init() { 942 943 var $toggleButton = jQuery('#mobile_menu_toggler'); 944 $menuButton = jQuery('#m_nav_menu'); 945 $menuButtonBars = jQuery('.m_nav_ham'); 946 947 // Mobile Menu SlideToggle 948 $toggleButton.click(function(){ 949 jQuery(this).toggleClass('active_mobile_menu'); 950 jQuery('#mobile_menu').stop(true,true).slideToggle(400,"easeOutCubic"); 951 }); 952 953 // Change Button style 954 $toggleButton.on("click", function(){ 955 if($toggleButton.hasClass('active_mobile_menu')) 956 { 957 $menuButtonBars.removeClass('button_closed'); 958 $menuButtonBars.addClass('button_open'); 959 jQuery("#m_ham_1").addClass("m_nav_ham_1_open"); 960 jQuery("#m_ham_2").addClass("m_nav_ham_2_open"); 961 jQuery("#m_ham_3").addClass("m_nav_ham_3_open"); 962 } 963 else 964 { 965 $menuButtonBars.removeClass('button_open'); 966 $menuButtonBars.addClass('button_closed'); 967 jQuery("#m_ham_1").removeClass("m_nav_ham_1_open"); 968 jQuery("#m_ham_2").removeClass("m_nav_ham_2_open"); 969 jQuery("#m_ham_3").removeClass("m_nav_ham_3_open"); 970 } 971 }); 972} 973 974 975// Check for Particles Animation 976jQuery(window).load(function(){ 977 if(jQuery('#particles_animation').boc_doesExist()) { 978 if(jQuery('#particles_animation').hasClass("particles_on_top")){ 979 particlesJS('particles_animation','particles_animation','top'); 980 }else { 981 particlesJS('particles_animation','particles_animation','bottom'); 982 } 983 } 984});
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.