1var CoreJS; 2 3(function($) { 4 "use strict"; 5 6 CoreJS = { 7 8 initialized: false, 9 10 initialize: function() { 11 12 if (this.initialized) return; 13 this.initialized = true; 14 15 this.build(); 16 17 this.events(); }, 18 19 build: function() { 20 21 this.lightbox(); 22 23 this.retina(); }, 24 25 events: function() { 26 27 $(function(){ 28 // Check for ThumbnailGird Element and Run Function 29 if( $('.og-grid-link').get(0) ) CoreJS.thumbnailGrid(); 30 31 // Menu 32 $(".met_primary_nav").superfish({ 33 delay: 700, 34 speed: 'fast', 35 speedOut: 'fast', 36 animation:{opacity:'show'} 37 }); 38 39 // Tags Toggler 40 var $tags = $('.met_tags_trigger'); 41 if( $tags.get(0) ){ 42 $tags.on('click', function(){ 43 var $this = $(this), 44 $next = $this.nextAll('.met_blog_block_tag_list'); 45 if( $this.is(':contains("+")') ){ 46 $next.stop().slideDown(); 47 $this.html($this.html().replace(' \+',' -')); 48 }else{ 49 $next.stop().slideUp(); 50 $this.html($this.html().replace(' \-',' +')); 51 } 52 return false; 53 }); 54 } 55 56 // Calculate Fullwidthes 57 CoreJS.fullWidthCalc(); 58 $(window).on('debouncedresize', CoreJS.fullWidthCalc); 59 60 // If Any Animation Element Exists Then Run Which Has to be Run 61 if( $('.met_run_animations').get(0) && !$('.dslca-enabled').get(0) && !$('#met_page_pl_overlay').get(0) ){ 62 $(window).load(function(){ 63 CoreJS.wowAnimate('met_run_animations'); 64 }); 65 } 66 67 68 // MC Mega Menu - Sidebar Width Fix 69 $('.mmm-sidebar').each(function(){ 70 $(this).parent('.mmm-column-0').css('width', $(this).css('width')); 71 }); 72 73 // Align Sub Menus 74 $('.met_header_menu').imagesLoaded(CoreJS.subMenuAlign); 75 76 // Tabbed Mega Posts Menu 77 if($('.met_megamenu_tabbed_posts_wrapper').get(0)){ 78 79 $('.met_megamenu_tabbed_post_cats + .met_megamenu_tabbed_posts').addClass('on'); 80 var timeout; 81 82 $('.met_megamenu_tabbed_post_cats li').on('hover', function(){ 83 clearTimeout(timeout); 84 var $this = $(this); 85 86 timeout = setTimeout(setNew,150); 87 88 function setNew(){ 89 var theParent = $this.parents('li.clearfix'), 90 hovered = theParent.find('.met_megamenu_tabbed_posts[data-cat="'+$this.data('cat')+'"]'); 91 if(!hovered.hasClass('on')){ 92 theParent.find('.on').removeClass('on'); 93 hovered.addClass('on'); 94 } 95 } 96 }); 97 } 98 99 // WordPress Comment Form Styling Hacks -muratkaracam 100 $('#commentform input[type="submit"]').addClass('btn btn-xs btn-primary'); 101 $('.met_content_box .comment-respond #reply-title').css('display','none'); 102 $('.comment-reply-link').click(function(){ 103 $('.met_comment_box .comment-respond #reply-title').css('display','block'); 104 }); 105 106 $('#cancel-comment-reply-link').on('click',function(){ 107 $('.met_content_box .comment-respond #reply-title').css('display','none'); 108 }); 109
110 CoreJS.parallaxInit(); 111 }); 112 113 // Check If Any Navigation Item Has Hashtag Link and Apply One Page Navigation 114 $(window).load(function(){ 115 if( $('.met_header_wrap [href^="#"]').filter(function(){return $(this).attr('href').length > 1}).get(0) ){ 116 $('.met_primary_nav, #met_mobile_menu').onePageNav({ 117 currentClass: 'current-menu-item', 118 changeHash: false, 119 scrollSpeed: 750, 120 scrollThreshold: 0.1, 121 filter: '', 122 easing: 'swing', 123 offsetElements: '.met_sticky_header,#wpadminbar' 124 }); 125 } 126 setTimeout(function(){ 127 if(!$('#LTEIE9').get(0))CoreJS.fitColumnHeight(); 128 }, 500) 129 }); 130 131 }, 132 133 parallaxInit: function(){ 134 135 var uA = window.navigator.userAgent, 136 safari = /Safari/i.test(uA), 137 chrome = /Chrome/i.test(uA); 138 //Parallax replace for front-end ( dslc -> met ) 139 if( !$('body').hasClass('dslca-enabled') && !$('#LTEIE9').get(0) && ( (safari && chrome) || (!safari && chrome) || (!safari && !chrome) ) ){ 140 141 // Check if there are any background parallaxes and build a transform parallax 142 var $bg_parallaxes = $('.dslc-init-parallax').filter( 143 function(){ 144 var bgimg = $(this).css('background-image'); 145 return bgimg != 'none' && bgimg.replace(/^url|'|"|[\(\)]/g, '') != '' 146 } 147 ); 148 if( $bg_parallaxes.get(0) ){ 149 $bg_parallaxes.attr({ 150 'data-met-parallax': 'true', 151 'data-parallax-isbg': 'true' 152 }).addClass('met_parallax_line').removeClass('dslc-init-parallax'); 153 154 if( window['dslc_parallax'] != undefined ){ 155 window['dslc_parallax'] = function(){return} 156 } 157 158 $bg_parallaxes.each(function(){ 159 var $this = $(this); 160 161 // Overlay 162 var pOverlay = $(this).find('.dslc-bg-video-overlay'), 163 pOpacity = parseFloat(pOverlay.css('opacity')), 164 pBgColor = pOverlay.css('background-color').replace(/^rgb|a|[\(\)]/g, '').split(', '), 165 pAlpha = pOpacity != 0 ? ( pBgColor.length > 3 ? parseFloat(pBgColor[3]) : 1 ) : 0, 166 newAlpha = pOpacity * pAlpha, 167 newColor = pBgColor[0] + ', ' + pBgColor[1] + ', ' + pBgColor[2] + ', ' + newAlpha, 168 newColor = 'rgba('+ newColor +')'; 169 170 $(this).addClass('met-parallax-overlay').css('color', newColor); 171 }); 172 $.fn.parallax(); 173 } 174 } 175 176 if( $(window).width() > 768 ){ 177 //init stellar 178 $('body').stellar({ 179 responsive: true, 180 horizontalScrolling: false, 181 positionProperty: 'transform', 182 scrollProperty: 'scroll', 183 parallaxBackgrounds: false, 184 parallaxElements: true, 185 hideDistantElements: false 186 }); 187 188 CoreJS.updateParallaxModules(); 189 190 //Update all parallax layer wrappers 191 if( $('.met_parallax_layer_item' ).get(0) ){ 192 $('.met_parallax_layer_item').each(function(){ 193 CoreJS.updateParallaxLayers( $(this).parents('.dslc-module-front' ).attr('id') ); 194 }); 195 } 196 197 //Re-build parallax layers on "dslc option change" 198 $(document).on( 'change', '.dslca-module-edit-field', function(){ 199 var dslcModule = $('.dslca-module-being-edited').attr('id'); 200 201 if( $('#'+dslcModule).find('.met_parallax_layer_data').get(0) ){ 202 setTimeout(function(){ 203 CoreJS.updateParallaxLayers(dslcModule); 204 }, 2000); 205 } 206 207 if( $('#'+dslcModule).find('[data-met-core-parallax-element]').get(0) ){ 208 setTimeout(function(){ 209 CoreJS.updateParallaxModules(); 210 }, 2000); 211 } 212 213 }); 214 215 //Re-build parallax layers on "dslc new module drop" 216 jQuery( '.dslc-modules-area' ).on("drop", function( event, ui ) { 217 if( $('.met_parallax_layer_item' ).get(0) ){ 218 setTimeout(function(){ 219 $('.met_parallax_layer_item').each(function(){ 220 CoreJS.updateParallaxLayers( $(this).parents('.dslc-module-front' ).attr('id') ); 221 }); 222 }, 2000); 223 } 224 225 setTimeout(function(){ 226 CoreJS.updateParallaxModules(); 227 }, 2000); 228 }); 229 230 //Re-build parallax layers on "dslc module save" 231 $(document).on( 'click', '.dslca-module-edit-save', function(){ 232 if( $('.met_parallax_layer_item' ).get(0) ){ 233 setTimeout(function(){ 234 $('.met_parallax_layer_item').each(function(){ 235 CoreJS.updateParallaxLayers( $(this).parents('.dslc-module-front' ).attr('id') ); 236 }); 237 }, 2000); 238 } 239 240 setTimeout(function(){ 241 CoreJS.updateParallaxModules(); 242 }, 2000); 243 244 }); 245 246 //Move parallax layer to front on hover ( for lower z-indexed layers ) 247 $('.dslca-enabled').find('[data-stellar-element]').hover( function() { 248 $( this ).attr( 'data-old-z-index', $( this ).css('z-index') ); 249 $( this ).css( 'z-index', '999' ); 250 }, function() { 251 $( this ).css( 'z-index', $( this ).attr( 'data-old-z-index') ); 252 $( this ).removeAttr('data-old-z-index'); 253 } 254 ); 255 256 setTimeout(function(){ 257 CoreJS.updateParallaxModules(); 258 }, 2000); 259 } 260 }, 261 262 updateParallaxLayers: function(layer_item){ 263 var destination = $('#'+layer_item); 264 265 if( destination.find('.met_parallax_layer_data' ).get(0) ){ 266 //console.log(layer_item); 267 268 var source = destination.find('.met_parallax_layer_data')[0]; 269 270 for ( var i = 0; i < source.attributes.length; i++ ){ 271 var a = source.attributes[i]; 272 if( a.name != 'class'){ 273 var data_name = a.name.replace('metparallax','stellar'); 274 destination.attr(data_name, a.value); 275 } 276 } 277 278 destination.attr('data-dslc-module-size','1'); 279 var $parallaxImg = destination.find('img'); 280 var $img; 281 $img = $('<img>').attr('src', $parallaxImg.attr('src')).on('load', function () { 282 $img.remove(); 283 $img = null; 284 destination.css('width', destination.find('img').outerWidth() ); 285 }); 286 287 destination.removeAttr( 'data-dslc-anim data-dslc-anim-delay data-dslc-anim-easing data-dslc-anim-easing' ); 288 destination.removeClass( 'dslc-first-col dslc-last-col dslc-in-viewport-check dslc-in-viewport-anim-none dslc-in-viewport' ); 289 290 if( $('body').hasClass('dslca-enabled') ){ 291 destination.parents( '.dslc-modules-area' ).find( '.dslca-no-content' ).css( {'display': 'block'} ).find( '.dslca-no-content-primary' ).css( { 292 'color' : '#fff', 293 'background': '#000', 294 'font-size' : '25px' 295 } ).find( '.dslc-icon-download-alt' ).removeAttr( 'class' ).addClass( 'fa fa-crosshairs' ).next( '.dslca-no-content-help-text' ).html( ' Drop new layers here!' ); 296 } 297 298 //console.log('update parallax layers'); 299 CoreJS.updateStellar(); 300 } 301 }, 302 303 updateParallaxModules: function(){ 304 305 if( $('body').hasClass('dslca-enabled' ) ){ 306 307 $( '.dslc-modules-area' ).each(function(){ 308 var $dslc_modules_area = $(this); 309 310 if( $dslc_modules_area.find('[data-met-core-parallax-element]').get(0) ){ 311 $dslc_modules_area.find( '.dslca-no-content' ).css( {'display': 'block'} ).find( '.dslca-no-content-primary' ).css( { 312 'color' : '#fff', 313 'background': '#000', 314 'font-size' : '25px' 315 } ).find( '.dslc-icon-download-alt' ).removeAttr( 'class' ).addClass( 'fa fa-crosshairs' ).next( '.dslca-no-content-help-text' ).html( ' Drop new layers here!' ); 316 } 317 318 CoreJS.updateStellar(); 319 }); 320 321 } 322 323 var $parallaxContainer = $( '.dslc-modules-area').filter(function(){ return $(this).find('[data-stellar-element]').get(0) }); 324 $parallaxContainer.each(function(){ 325 326 var $_parallaxContainer = $(this), 327 $parallaxImg = $_parallaxContainer.find('img'), 328 $count = $parallaxImg.length, 329 $highestImgHeight = 0, 330 $currentImgHeight = 0; 331 332 if( $parallaxImg.get(0) ){ 333 $_parallaxContainer.imagesLoaded(function(){ 334 $parallaxImg.each(function(index,el){ 335 336 $currentImgHeight = $(this).height(); 337 338 if( $highestImgHeight == 0 ) 339 $highestImgHeight = $currentImgHeight; 340 else if( $currentImgHeight > $highestImgHeight ) 341 $highestImgHeight = $currentImgHeight; 342 343 if (index == $count - 1 && $highestImgHeight) { 344 $_parallaxContainer.css('height', $highestImgHeight); 345 CoreJS.updateStellar(); 346 } 347 }); 348 }); 349 }else{ 350 $_parallaxContainer.css('min-height', $('[data-stellar-element]', this).outerHeight()); 351 CoreJS.updateStellar(); 352 } 353 }); 354 355 if( $('[data-met-core-parallax-element]').get(0) ){ 356 //console.log('update parallax modules [checked]'); 357 358 $('[data-met-core-parallax-element]').each(function(){ 359 var $core_el = $(this); 360 var $parent_el = $core_el.parents('.dslc-module-front'); 361 362 var s_ratio = $core_el.attr('data-stellar-ratio'); 363 var s_voffset = $core_el.attr('data-stellar-vertical-offset'); 364 365 $core_el.removeAttr('data-stellar-element').removeAttr('data-stellar-ratio data-stellar-vertical-offset'); 366 367 $parent_el.attr('data-stellar-element','' ) 368 .attr('data-stellar-ratio', s_ratio ) 369 .attr('data-stellar-vertical-offset',s_voffset ) 370 371 .css('left', $core_el.attr('data-pos-x')+'%' ) 372 .css('top', $core_el.attr('data-pos-y')+'%' ) 373 .css('z-index', $core_el.attr('data-pos-z') ); 374 375 CoreJS.updateStellar(); 376 }); 377 } 378 379 //console.log('update parallax modules'); 380 CoreJS.updateStellar(); 381 }, 382 383 updateStellar: function(){ 384 $('body').stellar('refresh'); 385 //console.log('refresh stellar'); 386 }, 387 388 thumbnailGrid: function(){ 389 390 var $allowAnimation = 350, 391 $adminbar = $('#wpadminbar'), 392 $stickyHeader = $('.met_sticky_header'), 393 $offsetMinus = 0; 394 395 if( $adminbar.get(0) ) $offsetMinus -= $adminbar.height(); 396 if( $stickyHeader.get(0) ) $offsetMinus -= $stickyHeader.height(); 397 398 function setHeight($container){ 399 var $windowWidth = $(window).width(), 400 $maxWidth = 1905, 401 $maxHeight = 500, 402 $newHeight = ($windowWidth * $maxHeight) / $maxWidth, 403 $imageLi = $container.parents('li'), 404 $imageHeight = $container.parents('li').find('.met_hover_effect_preview_caption a').height(), 405 $addition = 0; 406 407 $addition += parseInt($container.find('.og-expander-inner').css('padding-top')), 408 $addition += parseInt($container.find('.og-expander-inner').css('padding-bottom')), 409 $addition += $container.find('.og-details > h3').outerHeight(true), 410 $addition += $container.find('.og-details > p').outerHeight(true), 411 $addition += $container.find('.og-details > a').outerHeight(true); 412 413 if( $newHeight < $addition ) $newHeight = $addition; 414 415 $imageLi.animate({ 416 height: ($newHeight + $imageHeight + 10)+'px' 417 }, $allowAnimation, 'easeInOutExpo' ); 418 $container.css('height', $newHeight ); 419 } 420 421 function createLoadImg($src, $imgContainer){ 422 $( '<img/>' ).load(function(){ 423 var $img = $( this ), 424 $largeImg = $img.fadeIn( 350 ); 425 426 $imgContainer.children('.og-loading').hide(); 427 $imgContainer.append( $largeImg ); 428 }).attr( 'src', $src ); 429 } 430 431 function builder($into, $data){
432 // Create/Append the Container Area 433 434 var $imgBox = ''; 435 if( $data.largeSRC != '' ) $imgBox = '<div class="og-fullimg"><div class="og-loading" style="display: block;"></div></div>'; 436 437 438 $into.append('<div class="og-expander" style="transition: height '+$allowAnimation+'ms ease; -webkit-transition: height '+$allowAnimation+'ms ease; height: 0;"><div class="og-expander-inner"><span class="og-close"></span>'+ $imgBox +'<div class="og-details"><h3></h3><p></p><a target="'+ $data.buttontarget +'" href="'+ $data.buttonsrc +'">'+ $data.buttontext +'</a></div></div></div>').addClass('og-expanded'); 439 440 // Set Datas into Indivisual Areas 441 $into.find('.og-details > h3').text($data.title); 442 $into.find('.og-details > p').text($data.description); 443 //$into.find('.og-details > a').attr('href', $data.href); 444 445 $into.find('.og-close').on('click', function(){ 446 $allowAnimation = 350; 447 destroyer($(this).parents('li')); 448 return false; 449 }); 450 451 // Set the First Height for the Expanded Area 452 setHeight($into.children('.og-expander')); 453 $(window).on('debouncedresize', function(){setHeight($into.children('.og-expander'),true)}); 454 455 // Create Img Tag and Load the Image 456 if( $data.largeSRC != '' ) createLoadImg($data.largeSRC, $into.find('.og-fullimg')); 457 } 458 459 function destroyer($into){ 460 $into.animate({ 461 height: $into.children('figure').height()+'px' 462 }, $allowAnimation,'easeInOutExpo',function(){ 463 $into.css('height', 'auto'); 464 }).removeClass('og-expanded'); 465 466 $into.find('.og-expander').fadeOut($allowAnimation,function(){$(this).remove()}); 467 } 468 469 $('.met_thumbnail_grid:not(.disable_expand) figure .og-grid-link').on('click touch', function(){ 470 471 if( $(window).width() < 700 ){ 472 return window.location.href = $(this).data('buttonsrc'); 473 } 474 475 $allowAnimation = 350; 476 var $this = $(this).parents('figure'), 477 $link = $this.find('.met_hover_effect_preview_caption a'), 478 $buildData = {}, 479 $expanded = $('.og-expander'), 480 $offsetTop = $this.offset().top, 481 $scrollTop = $offsetTop + $this.find('.met_hover_effect_preview_caption a').height() * 0.7, 482 $openedOffsetTop; 483 484 if( $this.parent().find('.og-expander').get(0) ){ 485 destroyer($this.parent('li')); 486 return; 487 }else if( $expanded.get(0) ){ 488 $openedOffsetTop = $expanded.parent('li').offset().top; 489 490 if( $openedOffsetTop == $offsetTop ){ 491 $allowAnimation = 0; 492 }else{ 493 if( $scrollTop > $openedOffsetTop ) $scrollTop -= $expanded.height(); 494 $allowAnimation = 350; 495 } 496 497 destroyer($expanded.parent('li')); 498 } 499 500 $buildData.largeSRC = $link.data('largesrc'), 501 $buildData.title = $link.data('title'), 502 $buildData.href = $link.attr('href'), 503 $buildData.description = $link.data('description'), 504 $buildData.buttonsrc = $link.data('buttonsrc'), 505 $buildData.buttontarget = $link.parents('ul').data('buttonopenin'), 506 $buildData.buttontext = $link.parents('ul').data('buttontext'); 507 508 builder($this.parent('li'), $buildData); 509 510 setTimeout(function(){ 511 $('html, body').animate({ 512 scrollTop: $scrollTop + $offsetMinus 513 }, 350,'easeInOutExpo'); 514 }, 10); 515 return false; 516 }); 517 518 $('.met_thumbnail_grid:not(.disable_expand) figure .met_hover_effect_icon.second').on('click', function () { 519 $(this).parents('figure').find('.og-grid-link').trigger('click'); 520 return false; 521 }); 522 523 }, 524 525 headerSearch: function(){ 526 $('.met_header_wrap .met_header_search').click(function(){ 527 $('.met_header_wrap .met_header_search_wrap').addClass('on'); 528 529 setTimeout(function(){ 530 $('.met_header_wrap .met_header_search_term').focus(); 531 }, 100); 532 }); 533 534 $('.met_sticky_header .met_header_search').on('click', function(){ 535 $(this).parents('.met_sticky_header').find('.met_header_search_wrap').addClass('on'); 536 var theinput = $(this).parents('.met_sticky_header').find('.met_header_search_wrap input'); 537 538 setTimeout(function(){ 539 theinput.focus(); 540 }, 100); 541 }); 542 543 $('.met_header_search_wrap .closer').on('click',function(){ 544 $(this).parents('.met_header_search_wrap').removeClass('on'); 545 }); 546 }, 547 548 responsiveUtilities: function(){ 549 function responsiveMenuButton(){ 550 if( $(window).scrollTop() > $('.met_header_wrap').height() ) { 551 $('#met_mobile_bar_bottom_button').css('transform', 'translateX(20px) translateZ(0)'); 552 } else { 553 $('#met_mobile_bar_bottom_button').css('transform', 'translateX(-100%) translateZ(0)'); 554 } 555 } 556 557 558 559 $('.met_mobile_bar_trigger').on('click', function(e){ 560 e.preventDefault(); 561 CoreJS.toggleMobileBar(); 562 }); 563 $('#met_mobile_bar_bottom_button,#met_mobile_bar_closer').on('click touchstart', function(e){ 564 e.preventDefault(); 565 CoreJS.toggleMobileBar(); 566 }); 567 568 $('#met_mobile_bar .menu-item-has-children > a').filter(function(){return $(this).html() === " "}).hide(); 569 $('#met_mobile_bar .menu-item-has-children > a').on('click', function(e){ 570 e.preventDefault(); 571 var child = $(this).next('ul'); 572 573 if(child.hasClass('on')){ 574 child.removeClass('on'); 575 child.slideUp(); 576 $(this).removeClass('met_mobile_menu_on'); 577 578 var empties = child.parent().nextAll().children('a').filter(function(){return $(this).html() === " "}), 579 emptiesUl = empties.next('ul'); 580 581 emptiesUl.removeClass('on'); 582 emptiesUl.slideUp(); 583 empties.removeClass('met_mobile_menu_on'); 584 }else{ 585 child.addClass('on'); 586 child.slideDown(); 587 $(this).addClass('met_mobile_menu_on'); 588 589 var empties = child.parent().nextAll().children('a').filter(function(){return $(this).html() === " "}), 590 emptiesUl = empties.next('ul'); 591 emptiesUl.addClass('on'); 592 593 emptiesUl.slideDown(); 594 empties.addClass('met_mobile_menu_on'); 595 } 596 }); 597 598 var onePageResponsiveLinks = $('#met_mobile_bar a[href^="#"]').filter(function(){ return $(this).attr('href').length > 1 && $($(this).attr('href')).get(0) }); 599 if( onePageResponsiveLinks.get(0) ){ 600 onePageResponsiveLinks.on('click', function(e){ 601 if( !$(this).parent('.current-menu-item').get(0) ){ 602 CoreJS.toggleMobileBar(); 603 } 604 e.preventDefault(); 605 }); 606 } 607 608 if( $(window).width() > 1024 ) return; 609 optimizedScroll.add(responsiveMenuButton); 610 }, 611 612 toggleMobileBar: function(){ 613 if($('#met_mobile_bar').css('display') == 'block'){ 614 $('.met_wrapper').removeClass('menu_open'); 615 $('#met_mobile_bar_bottom_button').removeClass('hide'); 616 $('#met_mobile_bar_closer').removeClass('show'); 617 618 $('#met_mobile_bar').fadeOut(); 619 $('html,body').css('overflow-x', 'visible'); 620 }else{ 621 $('#met_mobile_bar_bottom_button').addClass('hide'); 622 $('.met_wrapper').addClass('menu_open'); 623 $('#met_mobile_bar_closer').addClass('show'); 624 625 $('#met_mobile_bar').show(); 626 $('html,body').css('overflow-x', 'hidden'); 627 } 628 }, 629 630 responsiveTab: function(elID){ 631 $('#'+elID).each(function(){ 632 var lis = $(this).find('ul > li > a'), 633 divs = $(this).children('div'), 634 ids = new Array(), 635 iqw = 0, 636 qwe = 0; 637 638 lis.each(function(){ 639 ids[iqw] = $(this).attr('href').replace('#',''); 640 iqw++; 641 }); 642 643 divs.each(function(){ 644 $(this).attr('id',ids[qwe]); 645 qwe++; 646 }); 647 648 $(this).responsiveTabs({ 649 startCollapsed: 'accordion', 650 collapsible: false, 651 rotate: false, 652 animation: 'slide', 653 duration: 300, 654 active: 0 655 }); 656 }); 657 }, 658 659 scrollUp: function(){ 660 function pos(){ 661 if($(window).scrollTop() != 0) { 662 $('#met_scroll_up').css('transform', 'translateX(-20px) translateZ(0)'); 663 } else { 664 $('#met_scroll_up').css('transform', 'translateX(100%) translateZ(0)'); 665 } 666 } 667 668 optimizedScroll.add(pos); 669 670 $('#met_scroll_up').on('click touchstart', function(e) { 671 e.preventDefault(); 672 $('body,html').animate({scrollTop:0},800); 673 }); 674 }, 675 676 googleMapToggler: function(elID){ 677 $('#'+elID).on('click touchstart', function(e){ 678 e.preventDefault(); 679 680 var wrapper = $(this).next('.map_wrapper'); 681 682 if(wrapper.hasClass('map_hidden')){ 683 wrapper.slideDown(500); 684 wrapper.removeClass('map_hidden'); 685 }else{ 686 wrapper.slideUp(500); 687 wrapper.addClass('map_hidden'); 688 } 689 }); 690 }, 691 692 stickyHeader: function(){ 693 var fixed_header = $('.met_fixed_header'), 694 body = $('body'), 695 LTE_IE_9 = $('#LTEIE9'), 696 sizing, 697 sticky_header, 698 status = {'on': {},'off': {}}; 699 700 if( !LTE_IE_9.get(0) ){ 701 status['on'] = {'transform': 'translateY(0) translateZ(0)'}; 702 status['off'] = {'transform': 'translateY(-100%) translateZ(0)'}; 703 }else{ 704 status['on'] = {'top': '0'}; 705 status['off'] = {'top': '-100px'}; 706 } 707 708 function stickyHeaderPos(){ 709 if( $(window).scrollTop() > parseInt(sticky_header.data('visibleat')) ){ 710 sticky_header.css(status['on']); 711 }else{ 712 sticky_header.css(status['off']); 713 714 sticky_header.find('.met_header_search_wrap.on').toggleClass( 'on', false ); 715 } 716 } 717 718 function sizing(sticky_header){ 719 var pageWrapper = $('.met_page_wrapper'), 720 maxW = pageWrapper.outerWidth(), 721 left = pageWrapper.offset().left; 722 723 sticky_header.css({ 724 'max-width': maxW+'px', 725 'left': left+'px', 726 'padding': '0px' 727 }); 728 } 729 730 if(fixed_header.get(0) && body.width() > 1024){ 731 var theLogo = $('.met_header_wrap .met_logo').clone(), 732 menu = $('.met_header_wrap nav').clone(), 733 search = $('.met_header_wrap .met_header_search').clone(),
734 searchWrap = $('.met_header_wrap .met_header_search_wrap').clone(), 735 socials = $('.met_header_wrap .met_header_socials').clone(), 736 links = $('.met_header_wrap .met_header_links').clone(), 737 wpadminbar = $('#wpadminbar'), 738 stickyLogoSrc = theLogo.data('sticky-src'), 739 stickyLogoText = theLogo.data('sticky-text'), 740 adminbarheight = wpadminbar.get(0) ? wpadminbar.height() : 0; 741 742 if( !$('.met_header_wrap').hasClass('met_fixed_wide_header') || $('body').hasClass('met_boxed_layout') ){ 743 var inthis = '.met_sticky_header > .met_content'; 744 var inContent = '<div class="met_content clearfix"></div>'; 745 }else{ 746 var inthis = '.met_sticky_header'; 747 var inContent = ''; 748 } 749 750 body.append('<div class="met_sticky_header off hidden-1024">'+ inContent +'</div>'); 751 752 sticky_header = $('.met_sticky_header'); 753 754 sticky_header.css('top', adminbarheight+'px'); 755 sticky_header.css('height', fixed_header.data('stickyheight')); 756 if( $('.met_header_wrap').hasClass('met_fixed_wide_header') ){ 757 sticky_header.find(' > div').addClass('met_sticky_header_color_apply'); 758 } 759 760 menu.children('ul').removeAttr('id'); 761 762 theLogo.appendTo(inthis); 763 menu.appendTo(inthis); 764 search.appendTo(inthis); 765 searchWrap.appendTo('.met_sticky_header'); 766 socials.appendTo(inthis); 767 768 var stickyLogo = sticky_header.find('.met_logo'); 769 stickyLogo.addClass('met_vcenter'); 770 771 if( stickyLogoSrc != '' ){ stickyLogo.find('img').attr('src', stickyLogoSrc); } 772 if( stickyLogoText != '' ){ stickyLogo.find('span').html(stickyLogoText); } 773 774 var logo = $('header .met_logo'); 775 776 logo.imagesLoaded(function(){ 777 var logoWidth = stickyLogo.outerWidth() + stickyLogo.position().left, 778 padLeft = parseInt(sticky_header.css('padding-left')); 779 sticky_header.find('.met_primary_nav').css('padding-left', logoWidth +'px').show(); 780 }); 781 782 sticky_header.find('nav .met_header_search').remove(); 783 sticky_header.attr('data-visibleat', (fixed_header.position().top + fixed_header.height() - 60)); 784 785 optimizedScroll.add(stickyHeaderPos); 786 787 if($('.met_side_navbar_wrap').get(0)){ 788 sizing(sticky_header); 789 $(window).on('debouncedresize', sizing(sticky_header)); 790 } 791 } 792 }, 793 794 subMenuAlign: function(){ 795 796 function calc(){ 797 var subMenu = $('.met_header_menu .main-menu-item.met_primary_nav_mega > ul[class*="mmm-sub-menu-align-"]:not(.mmm-sub-menu-is-full-width),.met_header_menu .main-menu-item.met_primary_nav_posts > ul[class*="mmm-sub-menu-align-"]:not(.mmm-sub-menu-is-full-width),.met_header_menu .main-menu-item.met_primary_nav_mega_posts > ul[class*="mmm-sub-menu-align-"]:not(.met_megamenu_tabbed_posts_wrapper):not(.mmm-sub-menu-is-full-width)'); 798 799 subMenu.each(function(){ 800 var $this = $(this), 801 wrapper = !$('.met_header_id_4').get(0) ? $this.parents('.met_primary_nav') : $this.parents('nav.met_content'), 802 li = $this.parents('.main-menu-item'), 803 dim = {}; 804 805 if( !wrapper.get(0) ) wrapper = $this.parents('.met_sticky_header'); 806 807 dim.width = $this.outerWidth(); 808 dim.wrapper = wrapper.outerWidth(); 809 dim.li = li.outerWidth(); 810 811 dim.wrapperOffsetX = parseFloat(wrapper.offset().left); 812 813 dim.offsetX = parseFloat($this.offset().left) - dim.wrapperOffsetX; 814 dim.liOffsetX = parseFloat(li.offset().left) - dim.wrapperOffsetX; 815 816 if( $this.hasClass('mmm-sub-menu-align-left') ){ 817 dim.pos = Math.max( 0, dim.liOffsetX - Math.max(0, ( ( dim.liOffsetX + dim.width ) - dim.wrapper )) ); 818 819 }else if( $this.hasClass('mmm-sub-menu-align-right') ){ 820 dim.pos = Math.max( 0, ( dim.liOffsetX + dim.li - dim.width ) ); 821 822 }else if( $this.hasClass('mmm-sub-menu-align-center') ){ 823 dim.pos = ( dim.liOffsetX + ( dim.li / 2 ) ) - ( dim.width / 2 ); 824 dim.pos = dim.pos > 0 ? dim.pos : 0; 825 826 if( dim.pos + dim.width > dim.wrapper ){ 827 dim.pos = dim.wrapper - dim.width; 828 } 829 830 } 831 832 $this.css({'left': dim.pos, 'right': 'auto'}); 833 }); 834 } 835 836 setTimeout(calc,550); 837 $(window).on('debouncedresize', calc); 838 }, 839 840 fitColumnHeight: function(){ 841 842 // Make sure only query with containers containing more than 1 column 843 var $containerBoxes = $('nav li[class*="met_primary_nav_"] .sub-menu[class*="mmm-"]'); 844 845 $containerBoxes.each(function(){ 846 var $box = $(this), 847 $columns = $box.children('.menu-item-has-children'); 848 849 $box.show(); 850 var h = $box.height(); 851 $box.hide(); 852 $columns.css('height', h ) 853 }); 854 855 /*$containerBoxes.each(function(){ 856 var $box = $(this), 857 $children = $box.children(), 858 $rows = {}, $rowsColumns = {}; 859 860 $children.each(function(){ 861 var $column = $(this); 862 863 if( $column.is('.menu-item-has-children') ){ 864 $rowsColumns[$rowsColumns.length + 1] = $column; 865 } 866 867 if( $column.is('.menu-item-is-divider') && $rowsColumns.length > 1 ){ 868 $rows[$rows.length + 1] = $rowsColumns; 869 $rowsColumns = {}; 870 } 871 }); 872 873 $.each($rows, function(k, o){ 874 var $currentHighest = Math.max.apply( null, $.map(o, function(el, index){ return $(el).height() }) ); 875 o.map( function(){ return $(this).height($currentHighest) }); 876 877 //o.height($currentHighest); 878 }); 879 });*/ 880 881 882 }, 883 884 stickySideNav: function(){ 885 $(".met_side_navbar_sticky").sticky({ 886 topSpacing: $('.met_side_navbar_sticky').offset().top, 887 className: 'sidenav-is-sticky', 888 wrapperClassName: 'sidenav-sticky-wrapper', 889 getWidthFrom: '.met_side_navbar_wrap' 890 }); 891 }, 892 893 loadStylesheet: function(styleSheets){ 894 $.each(styleSheets, function(key, value){ 895 896 var info = value.split('|'); 897 if( info.length < 1 || info[0] == '' ) return; 898 899 var fileUrl = info[0], 900 fileID = info.length > 1 ? info[1] : null; 901 902 if( fileID != null ){ 903 if( $('#' + fileID).get(0) ) return; 904 }else fileID = ''; 905 906 $.ajax({ 907 url: fileUrl, 908 cache: true, 909 success: function(data){ 910 $('head').append('<style id="' + fileID + '" type="text/css">' + data + '</style>'); 911 }, 912 error: function(data){ 913 console.log('Tried to load: ' + fileUrl + ' file but couldn\'t find it! Make sure file exists or contact the developer!'); 914 }, 915 }); 916 }); 917 }, 918 919 loadAsync: function(scripts,callBacks,dataArray){ 920 if(scripts.length == 0) 921 CoreJS.loadAsync_callBacks(callBacks,dataArray); 922 else 923 CoreJS.loadAsync_ajaxCalls(scripts,callBacks,dataArray); 924 }, 925 926 loadAsync_ajaxCalls: function(scripts,callBacks,dataArray){ 927 var options = {dataType: "script",cache: true}, 928 completedCounter = 0; 929 for(var i = 0; i < scripts.length; i++){ 930 options.url = scripts[i]; 931 options.complete = function(){ 932 completedCounter++; 933 if(completedCounter == scripts.length){ 934 CoreJS.loadAsync_callBacks(callBacks,dataArray); 935 } 936 }; 937 $.ajax( options ); 938 } 939 }, 940 941 loadAsync_callBacks: function(callBacks,dataArray){ 942 if(callBacks.length > 0){ 943 var callBackFunction = []; 944 for(var i = 0; i < callBacks.length; i++){ 945 callBackFunction = callBacks[i].split('|'); 946 window["CoreJS"][callBackFunction[0]](callBackFunction[1],dataArray); 947 } 948 } 949 }, 950 951 fittingVids: function(elID){ 952 var el = $('#' + elID); 953 954 if( el.get(0) ){ 955 el.fitVids(); 956 957 if( el.hasClass('met_isotope_item') && !el.parents('.row.grid').hasClass('window_load_isotope_layout_trigger') ){ 958 el.parents('.row.grid').addClass('window_load_isotope_layout_trigger'); 959 $(window).load(function(){ 960 setTimeout(function(){el.isotope('layout');},200); 961 }); 962 } 963 } 964 }, 965 966 header_1_nav_padding: function(){ 967 var logo = $('header .met_logo'); 968 969 logo.imagesLoaded(function(){ 970 var logoWidth = logo.outerWidth() + parseInt($('.met_header_wrap > header').css('padding-left')) - 1; 971 $('.met_primary_nav').css('padding-left', logoWidth).show(); 972 }); 973 974 }, 975 976 fullscreenScrolling: function(opts,videoPlaying){ 977 if( $(window).width() <= 1024 ){ 978 setTimeout(function(){ 979 $('body').removeClass('met_page_loading_padding'); 980 $(window).resize(); 981 $('.met_page_loading_overlay').addClass('met_page_loading_loaded'); 982 setTimeout(function(){$('.met_page_loading_overlay').remove()},400); 983 },300); 984 return; 985 } 986 987 var sections = $('#dslc-content .dslc-modules-section'), 988 container = $('#dslc-content'); 989 990 if(sections.get(0) && container.get(0)){ 991 $('body,html').animate({scrollTop:0},0); 992 sections.addClass('section'); 993 994 if(opts.fixedElements != ''){ 995 opts.paddingTop = $('.met_header_wrap').height()+'px'; 996 opts.paddingBottom = $('.footer_wrap').height()+'px'; 997 } 998 999 opts.afterRender = function(){ 1000 1001 setTimeout(function(){ 1002 $('body').removeClass('met_page_loading_padding'); 1003 $(window).resize(); 1004 $('.met_page_loading_overlay').addClass('met_page_loading_loaded'); 1005 setTimeout(function(){$('.met_page_loading_overlay').remove()},400); 1006 },300); 1007 1008 $('.met_header_wrap').addClass('met_fullpage_effect_header'); 1009 } 1010 opts.afterLoad = function(anchorLink,index){ 1011 1012 var $stickyHeader = $('.met_sticky_header'),
1013 $fullPageEffectHeader = $('.met_fullpage_effect_header'); 1014 if( $stickyHeader.get(0) ){ 1015 if( index === 1 ){ 1016 $fullPageEffectHeader.unbind('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd'); 1017 1018 $stickyHeader.css('transform', 'translateY(-100%) translateZ(0)'); 1019 $stickyHeader.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){ 1020 $fullPageEffectHeader.removeClass('off'); 1021 }); 1022 }else{ 1023 $stickyHeader.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 1024 1025 $fullPageEffectHeader.addClass('off'); 1026 $fullPageEffectHeader.bind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd", function(){ 1027 $stickyHeader.css('transform', 'translateY(0) translateZ(0)'); 1028 }); 1029 1030 } 1031 }else{ 1032 if( index === 1 ){ 1033 $fullPageEffectHeader.removeClass('off'); 1034 }else{ 1035 $fullPageEffectHeader.addClass('off'); 1036 } 1037 } 1038 1039 1040 if(videoPlaying === false){ 1041 var v = $(".section").eq(index-1).find("video"); 1042 if(v.get(0)) v[0].play(); 1043 }else{ 1044 $(".section").find("video").each(function(){ 1045 var v = $(this); 1046 v[0].play(); 1047 }); 1048 } 1049 var $currentSection = $(".section:eq("+(index-1)+")"), 1050 animations = $currentSection.find("[data-wow-animation]").not('.effect-none').not('.animated'), 1051 countTos = $currentSection.find(".countTo").not('.counted'), 1052 delayIncrease = 0; 1053 1054 countTos.each(function(){ 1055 var $this = $(this); 1056 $this.addClass('counted').countTo(); 1057 1058 }); 1059 1060 animations.each(function(){ 1061 1062 var $this = $(this), 1063 wowAnimation = $this.data('wow-animation'), 1064 wowDuration = $this.data('wow-duration'), 1065 wowIteration = $this.data('wow-iteration'), 1066 wowDelay = $this.data('wow-delay'); 1067 1068 setTimeout(function(){ 1069 $this.css({ 1070 '-webkit-animation': wowAnimation + ' ' + wowDuration + ' 0s ' + wowIteration, 1071 '-moz-animation': wowAnimation + ' ' + wowDuration + ' 0s ' + wowIteration, 1072 '-ms-animation': wowAnimation + ' ' + wowDuration + ' 0s ' + wowIteration, 1073 'animation': wowAnimation + ' ' + wowDuration + ' 0s ' + wowIteration, 1074 'visibility': 'visible' 1075 }); 1076 $this.addClass('animated'); 1077 }, parseFloat(wowDelay) * 1000 + delayIncrease); 1078 if( $this.parent().hasClass('grid') ) delayIncrease += 150; 1079 }); 1080 } 1081 container.fullpage(opts); 1082 }else{ 1083 $('body').removeClass('met_page_loading_padding'); 1084 $('.met_page_loading_overlay').remove(); 1085 } 1086 }, 1087 1088 theGrid: function( elID ){ 1089 var caption = $('#' + elID), 1090 $window = $(window), 1091 uniqueClass = caption.data('unique-class'), 1092 $items = caption.find('.met_isotope_item'); 1093 1094 if( caption.get(0) ){ 1095 1096 caption.imagesLoaded(function(){ 1097 var isotoped = caption.isotope({ 1098 itemSelector: '.met_isotope_item', 1099 isInitLayout: false, 1100 transitionDuration: 0, 1101 layoutMode: 'masonry', 1102 isResizeBound: true, 1103 masonry: {columnWidth: $items[0], gutter: 0} 1104 }); 1105 1106 isotoped.isotope( 'once', 'layoutComplete', function(){ 1107 /*$('html, body').animate({ 1108 scrollTop: $window.scrollTop() + 1 1109 }, 1, function(){ 1110 $('html, body').animate({ 1111 scrollTop: $window.scrollTop() - 1 1112 }, 1); 1113 });*/ 1114 if( !caption.hasClass('effect-none') ) 1115 CoreJS.wowAnimate(uniqueClass); 1116 1117 if( caption.hasClass('no_gap') ) 1118 setTimeout(function(){ isotoped.isotope('layout') }, 100); 1119 }); 1120 isotoped.isotope('layout'); 1121 /*$window.on('load', CoreJS.gridOverlayRemover(caption,uniqueClass,isotoped));*/ 1122 1123 $('.' + elID + '_filters a').on('click', function(){ 1124 var selector = $(this).attr('data-filter'); 1125 if( $(this).parents('.met_page_head').get(0) ){ 1126 $('.' + elID + '_filters').find('span').html( $(this).html() ); 1127 }else{ 1128 if(!$(this).hasClass('activePortfolio')){ 1129 $(this).parents('ul').find('.activePortfolio').removeClass('activePortfolio'); 1130 $(this).addClass('activePortfolio'); 1131 } 1132 } 1133 if( !caption.hasClass('effect-none') ){ 1134 if( $('.dslc-modules-section.section.table').get(0) ){ 1135 $items.each(function(key, val){ 1136 1137 var $this = $(this), 1138 wowAnimation = $this.data('wow-animation'), 1139 wowDuration = $this.data('wow-duration'), 1140 wowIteration = $this.data('wow-iteration'), 1141 wowDelay = $this.data('wow-delay'); 1142 1143 setTimeout(function(){ 1144 $this.css({ 1145 '-webkit-animation': wowAnimation + ' ' + wowDuration + ' 0s ' + wowIteration, 1146 '-moz-animation': wowAnimation + ' ' + wowDuration + ' 0s ' + wowIteration, 1147 '-ms-animation': wowAnimation + ' ' + wowDuration + ' 0s ' + wowIteration, 1148 'animation': wowAnimation + ' ' + wowDuration + ' 0s ' + wowIteration, 1149 'visibility': 'visible' 1150 }); 1151 $this.addClass('animated'); 1152 }, parseFloat(wowDelay) * 1000 + (key * 150)); 1153 }); 1154 }else{ 1155 CoreJS.wowAnimate(uniqueClass); 1156 } 1157 } 1158 isotoped.isotope({ filter: selector }); 1159 isotoped.isotope('layout'); 1160 return false;
1161 }); 1162 }); 1163 } 1164 }, 1165 1166 wowAnimate: function(elClass){ 1167 if( $('#LTEIE9').get(0) ) return; 1168 var wow = new WOW({ 1169 boxClass: elClass, 1170 animateClass: 'animated', 1171 mobile: true, 1172 live: false 1173 }); 1174 return wow.init(); 1175 }, 1176 1177 // Full Width Calculator 1178 fullWidthCalc: function(){ 1179 var fullWidth = $('.met_page_wrapper').outerWidth(); 1180 $('.met_fullwidth_item').each(function(){ 1181 $(this).css({ 1182 width: fullWidth + 'px', 1183 'margin-left': -((fullWidth - $('.met_page_wrapper div.met_content').width()) / 2) + 'px' 1184 }).animate({opacity: 1},400); 1185 }); 1186 }, 1187 1188 header_1_heights: function(){ 1189 $('.met_header_box_right').css('height', $('.met_logo').outerHeight()+'px'); 1190 }, 1191 1192 // Lightbox Controls 1193 lightbox: function(){ 1194 if(typeof jQuery().magnificPopup == "undefined") return false; 1195 var rel_lb = $('[rel^="lb"]'), 1196 $dslcLbImage = $('.dslc-lightbox-image'), 1197 $smallScreen = $(window).width() < 700, 1198 $imgObj = { 1199 type: 'image', 1200 mainClass: 'mfp-zoom-in', 1201 tLoading: '', 1202 removalDelay: 500, //delay removal by X to allow out-animation 1203 callbacks: { 1204 imageLoadComplete: function() { 1205 var self = this, 1206 $img = self.wrap.find('.mfp-img'), 1207 $isNatural = $smallScreen || $img.width() != $img[0].naturalWidth || $img.height() != $img[0].naturalHeight ? false : true; 1208 1209 setTimeout(function() { 1210 self.wrap.addClass('mfp-image-loaded'); 1211 if( $isNatural ) { 1212 self.wrap.off('click.pinhandler'); 1213 self.wrap.removeClass('mfp-force-scrollbars'); 1214 1215 if( self.items.length > 1 ){ 1216 $img.addClass('mfp-natural'); 1217 self.wrap.on('click.pinhandler', 'img', function() { 1218 self.next(); 1219 }); 1220 }else{ 1221 $img.addClass('mfp-nothing-to-do-here'); 1222 self.wrap.on('click.pinhandler', 'img', function() { 1223 self.close(); 1224 }); 1225 } 1226 } 1227 }, 16); 1228 }, 1229 close: function() { this.wrap.removeClass('mfp-image-loaded'); }, 1230 open: function() { 1231 1232 if( $smallScreen ) return; 1233 var self = this; 1234 1235 self.wrap.on('click.pinhandler', 'img', function() { 1236 self.wrap.toggleClass('mfp-force-scrollbars') 1237 }); 1238 }, 1239 beforeClose: function() { 1240 this.wrap.off('click.pinhandler'); 1241 this.wrap.removeClass('mfp-force-scrollbars'); 1242 } 1243 }, 1244 image: { 1245 verticalFit: true, 1246 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 1247 titleSrc: function(item) { 1248 var title_string; 1249 1250 if( item.el.data('caption') !== undefined && item.el.data('desc') !== undefined ){ 1251 title_string = item.el.data('caption') + '<small>'+item.el.data('desc')+'</small>'; 1252 }else if( item.el.data('caption') !== undefined && item.el.data('desc') == undefined ){ 1253 title_string = item.el.data('caption'); 1254 } 1255
1256 return title_string; 1257 } 1258 } 1259 }, 1260 $galObj = { 1261 enabled: true, 1262 navigateByImgClick: $smallScreen ? true : false, 1263 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', // markup of an arrow button 1264 1265 tPrev: 'Previous (Left arrow key)', // title for left button 1266 tNext: 'Next (Right arrow key)' // title for right button 1267 }, 1268 $afterOpenIEfix; 1269 1270 $dslcLbImage.each(function(){ 1271 $(this).unbind(); 1272 window['dslc_init_lightbox'] = function(){return} 1273 $(this).magnificPopup($imgObj); 1274 }); 1275 1276 1277 $imgObj.gallery = $galObj; 1278 rel_lb.magnificPopup($imgObj); 1279 $(window).load(function(){ 1280 $('[rel^="lb"].bx-clone').on('click', function(){ 1281 $('a[href="'+ $(this).attr('href') +'"]').not('.bx-clone').click(); 1282 return false; 1283 }); 1284 }); 1285 1286 if( $('#LTEIE9').get(0) ){ 1287 $afterOpenIEfix = { 1288 open: function() { 1289 $(window).resize(); 1290 } 1291 }; 1292 } 1293 1294 var rel_video_lb = $('[rel^="video_lb"]'); 1295 rel_video_lb.each(function(){ 1296 $(this).magnificPopup({ 1297 disableOn: 700, 1298 type: 'iframe', 1299 mainClass: 'mfp-3d', 1300 removalDelay: 160, 1301 preloader: false, 1302 fixedContentPos: false, 1303 callbacks: $afterOpenIEfix 1304 }); 1305 }); 1306 var rel_iframe_lb = $('[rel^="iframe_lb"]'); 1307 rel_iframe_lb.each(function(){ 1308 $(this).magnificPopup({ 1309 disableOn: 700, 1310 type: 'iframe', 1311 mainClass: 'mfp-3d', 1312 removalDelay: 160, 1313 preloader: false, 1314 fixedContentPos: false, 1315 callbacks: $afterOpenIEfix 1316 }); 1317 }); 1318 var inline_lb = $('[rel^="inline_lb"]'); 1319 inline_lb.each(function(){ 1320 $(this).magnificPopup({ 1321 disableOn: 700, 1322 type: 'inline', 1323 mainClass: 'mfp-3d', 1324 removalDelay: 160, 1325 preloader: false, 1326 fixedContentPos: false, 1327 callbacks: $afterOpenIEfix 1328 }); 1329 }); 1330 1331 $( '.dslc-lightbox-gallery' ).each(function(){ 1332 $(this).magnificPopup({ delegate : 'a', type:'image', gallery:{ enabled: true } }); 1333 }); 1334 1335 // Touch Bindings 1336 if( $('html').hasClass('touch') ){ 1337 var touchTimeout; 1338 1339 rel_lb.on('touchstart', function(){ clearTimeout(touchTimeout); var $this = $(this); touchTimeout = setTimeout(function(){$this.trigger('click');}, 250)}); 1340 rel_video_lb.on('touchstart', function(){ clearTimeout(touchTimeout); var $this = $(this); touchTimeout = setTimeout(function(){$this.trigger('click');}, 250)}); 1341 rel_iframe_lb.on('touchstart', function(){ clearTimeout(touchTimeout); var $this = $(this); touchTimeout = setTimeout(function(){$this.trigger('click');}, 250)}); 1342 inline_lb.on('touchstart', function(){ clearTimeout(touchTimeout); var $this = $(this); touchTimeout = setTimeout(function(){$this.trigger('click');}, 250)}); 1343 } 1344 1345 1346 }, 1347 1348 // Recent Portfolio Works 1349 recentPortfolioWorks: function(){ 1350 var met_recent_portfolio = $('.met_recent_portfolio'); 1351 met_recent_portfolio.each(function(){ 1352 var e = $(this); 1353 e.bxSlider({ 1354 mode: 'horizontal', 1355 slideMargin: 30, 1356 slideWidth: 370, 1357 speed: 500, 1358 pager: false, 1359 controls: true, 1360 auto: true, 1361 pause: 2000, 1362 autoHover: true, 1363 minSlides: 1, 1364 maxSlides: 3, 1365 moveSlides: 1, 1366 nextSelector: e.parent('.met_recent_portfolio_wrap').prev('.met_recent_portfolio_nav'), 1367 prevSelector: e.parent('.met_recent_portfolio_wrap').prev('.met_recent_portfolio_nav'), 1368 nextText: '<i class="fa fa-angle-right"></i>', 1369 prevText: '<i class="fa fa-angle-left"></i>' 1370 }); 1371 }); 1372 }, 1373 1374 // Carousel Plugin for Blog Page items 1375 upcomingEventsSlider: function(elementID){ 1376 var met_upcoming_events_wrapper = $('#'+elementID), 1377 met_upcoming_events = met_upcoming_events_wrapper.find('.met_upcoming_events'); 1378 1379 met_upcoming_events.each(function(){ 1380 var e = $(this); 1381 var s = e.bxSlider({ 1382 mode: 'fade', 1383 slideMargin: 0, 1384 speed: 500, 1385 pager: false, 1386 controls: false, 1387 auto: true, 1388 pause: 5000, 1389 autoHover: true, 1390 minSlides: 1, 1391 maxSlides: 1, 1392 moveSlides: 1, 1393 adaptiveHeight: 1 1394 }); 1395 met_upcoming_events_wrapper.find('.met_upcoming_events_prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1396 met_upcoming_events_wrapper.find('.met_upcoming_events_next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1397 }); 1398 }, 1399 1400 // Carousel Plugin for Blog Page items 1401 postsCarousel: function(elementID){ 1402 var met_posts_carousel_wrapper = $('#'+elementID), 1403 met_posts_carousel = met_posts_carousel_wrapper.find('.met_posts_carousel'); 1404 1405 met_posts_carousel.each(function(){ 1406 var e = $(this); 1407 var s = e.bxSlider({ 1408 slideMargin: 0, 1409 speed: 500, 1410 pager: false, 1411 controls: false, 1412 auto: true, 1413 pause: 5000, 1414 autoHover: true, 1415 slideWidth: 380, 1416 responsive: true, 1417 minSlides: 1, 1418 maxSlides: 3, 1419 moveSlides: 1, 1420 adaptiveHeight: 0 1421 }); 1422 met_posts_carousel_wrapper.find('.met_upcoming_events_prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1423 met_posts_carousel_wrapper.find('.met_upcoming_events_next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1424 }); 1425 }, 1426 1427 // Carousel Plugin for Blog Page items 1428 postsCarousel2: function(elementID){ 1429 var met_portfolio_carousel_wrapper = $('#'+elementID), 1430 met_portfolio_carousel = met_portfolio_carousel_wrapper.find('.met_portfolio_carousel'); 1431 1432 if(!met_portfolio_carousel.get(0)) met_portfolio_carousel = met_portfolio_carousel_wrapper.find('.met_gallery_carousel_2'); 1433 1434 met_portfolio_carousel.each(function(){ 1435 var e = $(this); 1436 var s = e.bxSlider({ 1437 slideMargin: 0, 1438 speed: parseInt(met_portfolio_carousel_wrapper.data('speed')), 1439 pager: false, 1440 controls: false, 1441 auto: true, 1442 adaptiveHeight: false, 1443 slideWidth: 350, 1444 pause: parseInt(met_portfolio_carousel_wrapper.data('pause')), 1445 autoHover: true, 1446 responsive: true, 1447 minSlides: 1, 1448 maxSlides: parseInt(met_portfolio_carousel_wrapper.data('columns')), 1449 moveSlides: 1 1450 }); 1451 met_portfolio_carousel_wrapper.find('.prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1452 met_portfolio_carousel_wrapper.find('.next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1453 }); 1454 }, 1455 1456 // Box Carousel - Upcoming Events - Testimonials 1457 boxCarousel: function(elID){ 1458 var e = $('#'+ elID +' .met_box_carousel'); 1459 var s = e.bxSlider({ 1460 mode: e.data('carousel-mode'), 1461 slideMargin: 0, 1462 speed: 700, 1463 pager: false, 1464 controls: false, 1465 auto: true, 1466 pause: 5000, 1467 autoHover: true, 1468 minSlides: e.data('carousel-min'), 1469 maxSlides: e.data('carousel-max'), 1470 moveSlides: 1, 1471 adaptiveHeight: 1 1472 }); 1473 e.parents('.met_content_box').find('.met_upcoming_events_prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1474 e.parents('.met_content_box').find('.met_upcoming_events_next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1475 }, 1476 1477 // Box Testimonials 1478 boxTestimonials: function(elID){ 1479 var e = $('#'+ elID +' .met_content_box_slider'); 1480 var s = e.bxSlider({ 1481 mode: 'fade', 1482 slideMargin: 0, 1483 speed: e.data('speed'), 1484 pager: false, 1485 controls: false, 1486 auto: true, 1487 pause: e.data('pause'), 1488 autoHover: true, 1489 minSlides: 1, 1490 maxSlides: 1, 1491 moveSlides: 1, 1492 adaptiveHeight: 1 1493 }); 1494 e.parents('.met_content_box').find('.met_upcoming_events_prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1495 e.parents('.met_content_box').find('.met_upcoming_events_next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1496 }, 1497 1498 // Blog List Slider 1499 blogBlockSlider: function(elID){ 1500 var met_blog_block_slider = $('#' + elID); 1501 met_blog_block_slider.each(function(){ 1502 var e = $(this); 1503 var s = e.bxSlider({ 1504 mode: e.data('mode'), 1505 slideMargin: 0, 1506 speed: e.data('speed'), 1507 pager: false, 1508 controls: false, 1509 auto: e.data('auto'), 1510 pause: e.data('sliderpause'), 1511 autoHover: e.data('sliderautohover'), 1512 randomStart: e.data('randomstart'), 1513 infiniteLoop: e.data('infiniteloop'), 1514 adaptiveHeight: true, 1515 minSlides: 1, 1516 maxSlides: 1, 1517 moveSlides: 1 1518 }); 1519 e.parents('.met_blog_block_slider_container').find('.met_blog_block_slider_prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1520 e.parents('.met_blog_block_slider_container').find('.met_blog_block_slider_next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1521 }); 1522 }, 1523 1524 // Link Rotator 1525 linkRotator: function(elID){ 1526 var el = $('#'+ elID), 1527 wrap = el.find('.met_title_rotator_el_wrap'), 1528 title = el.children('.met_title_rotator_title'), 1529 met_title_rotator = el.find('.met_title_rotator_el'), 1530 inheader = $('.met_header_wrap #'+ elID), 1531 plusVal = 20; 1532 1533 if(inheader.get(0)){plusVal = 5} 1534 1535 function setRotatorMargin(){ if(title.get(0)) wrap.css('margin-left', (title.outerWidth() + plusVal) + 'px'); } 1536 setRotatorMargin(); 1537 $(window).resize(function(){setRotatorMargin();}); 1538 1539 if(met_title_rotator.get(0)){ 1540 met_title_rotator.bxSlider({ 1541 mode: 'fade', 1542 slideMargin: 0, 1543 speed: el.data('speed'), 1544 pager: false, 1545 controls: false, 1546 auto: true, 1547 pause: el.data('pausetime'), 1548 autoHover: true, 1549 minSlides: 1, 1550 maxSlides: 1, 1551 moveSlides: 1 1552 }); 1553 } 1554 1555 }, 1556 1557 // Twitter Feed 1558 twitter_feed: function(elID){ 1559 var el = $('#'+elID), 1560 nav = $('#'+elID+'_nav'); 1561 el.each(function(){ 1562 var e = $(this), 1563 s = e.bxSlider({ 1564 mode: 'fade', 1565 slideMargin: 0, 1566 speed: 1000, 1567 pager: false, 1568 controls: false, 1569 auto: true, 1570 pause: 6000, 1571 autoHover: true, 1572 minSlides: 1, 1573 maxSlides: 1, 1574 moveSlides: 1 1575 }); 1576 nav.find('.prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1577 nav.find('.next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1578 }); 1579 }, 1580 1581 // Twitter Feed 1582 twitter_box_feed: function(elID){ 1583 var el = $('#'+elID); 1584 el.find('section').each(function(){ 1585 var e = $(this), 1586 s = e.bxSlider({ 1587 mode: 'vertical', 1588 slideMargin: 0, 1589 speed: el.data('speed'), 1590 pager: false, 1591 controls: false, 1592 auto: el.data('autoplay'), 1593 pause: el.data('pause'), 1594 autoHover: true, 1595 minSlides: el.data('visible'), 1596 maxSlides: el.data('visible'), 1597 moveSlides: 1 1598 }); 1599 el.find('.prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1600 el.find('.next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1601 }); 1602 }, 1603 1604 // Quote Testimonials 1605 quote_testimonials: function(elID){ 1606 var el = $('#'+elID), 1607 met_quote_testimonials = el.find('.met_quote_testimonials_wrapper'); 1608 1609 met_quote_testimonials.each(function(){ 1610 var e = $(this), 1611 s = e.bxSlider({ 1612 mode: 'fade', 1613 slideMargin: 0, 1614 speed: 1000, 1615 pager: false, 1616 controls: false, 1617 auto: true, 1618 pause: 6000, 1619 autoHover: true, 1620 minSlides: 1, 1621 maxSlides: 1, 1622 moveSlides: 1 1623 }); 1624 el.next('.prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1625 el.next('.prev').next('.next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1626 }); 1627 }, 1628 1629 gallery_grid: function(elID){ 1630 var wrap = $('#'+elID), 1631 cols = parseInt(wrap.data('cols')), 1632 slides = wrap.find('.met_gallery_grid_first_row .met_gallery_grid_item'), 1633 firstRow = wrap.find('.met_gallery_grid_first_row'), 1634 secondRow = (cols * 2 <= slides.length), 1635 secondRowItems = secondRow ? wrap.find('.met_gallery_grid_item:gt('+ (cols-2) +')') : false, 1636 secondRowItemz = secondRow ? wrap.find('.met_gallery_grid_item:lt('+ (cols-1) +')') : false, 1637 secondBx = false;
1638 1639 if(secondRow){ 1640 wrap.append('<div class="met_gallery_grid_row"><div class="met_gallery_grid_second_row_wrap"><div class="met_gallery_grid_second_row clearfix"></div></div></div>'); 1641 secondRowItems.each(function(){ 1642 wrap.find('.met_gallery_grid_second_row').append($(this).clone()); 1643 }); 1644 secondRowItemz.each(function(){ 1645 wrap.find('.met_gallery_grid_second_row').append($(this).clone()); 1646 }); 1647 1648 wrap.find('.met_gallery_grid_second_row').each(function(){ 1649 var e = $(this); 1650 secondBx = e.bxSlider({ 1651 slideMargin: 0, 1652 speed: wrap.data('speed'), 1653 pager: false, 1654 controls: false, 1655 auto: false, 1656 pause: wrap.data('pause'), 1657 infiniteLoop: true, 1658 autoHover: true, 1659 slideWidth: wrap.find('.met_gallery_grid_item:first-child').width(), 1660 responsive: true, 1661 minSlides: cols, 1662 maxSlides: cols, 1663 moveSlides: 1, 1664 adaptiveHeight: 0 1665 }); 1666 }); 1667 } 1668 1669 firstRow.each(function(){ 1670 var e = $(this); 1671 var s = e.bxSlider({ 1672 slideMargin: 0, 1673 speed: wrap.data('speed'), 1674 pager: false, 1675 controls: false, 1676 auto: wrap.data('auto'), 1677 pause: wrap.data('pause'), 1678 infiniteLoop: true, 1679 autoHover: true, 1680 slideWidth: wrap.find('.met_gallery_grid_item:first-child').width(), 1681 responsive: true, 1682 minSlides: cols - 1, 1683 maxSlides: cols - 1, 1684 moveSlides: 1, 1685 adaptiveHeight: 0, 1686 onSlideNext: function(){ 1687 if(secondBx){ 1688 secondBx.goToNextSlide(); 1689 } 1690 }, 1691 onSlidePrev: function(){ 1692 if(secondBx){ 1693 secondBx.goToPrevSlide(); 1694 } 1695 } 1696 }); 1697 e.parents('.met_gallery_grid').find('.prev').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1698 e.parents('.met_gallery_grid').find('.next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1699 }); 1700 1701 slides.magnificPopup({ 1702 type: 'image', 1703 gallery:{ 1704 enabled: true 1705 }, 1706 image: { 1707 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 1708 titleSrc: function(item) { 1709 var title_string; 1710 1711 if( item.el.data('caption') !== undefined && item.el.data('desc') !== undefined ){ 1712 title_string = item.el.data('caption') + '<small>'+item.el.data('desc')+'</small>'; 1713 }else if( item.el.data('caption') !== undefined && item.el.data('desc') == undefined ){ 1714 title_string = item.el.data('caption'); 1715 } 1716
1717 return title_string; 1718 } 1719 } 1720 }); 1721 1722 /* 1723 secondRowItems.magnificPopup({ 1724 type: 'image', 1725 gallery:{ 1726 enabled: true 1727 } 1728 }); 1729 1730 secondRowItems.on('click',function(){ 1731 return false; 1732 alert('annen'); 1733 }); 1734 */ 1735 1736 wrap.find('.met_gallery_grid_first_row .met_gallery_grid_item.bx-clone, .met_gallery_grid_second_row .met_gallery_grid_item').click(function(){ 1737 wrap.find(".met_gallery_grid_first_row .met_gallery_grid_item[data-lightboxid='"+$(this).data('lightboxid')+"']:not(.bx-clone)").click(); 1738 return false; 1739 }); 1740 }, 1741 1742 gallery_slider: function(elID){ 1743 var sliderElement = $('#'+elID+' .theSlider'); 1744 var carouselElement = $('#'+elID+' .theCarousel'); 1745 var syncSelector = ''; 1746 1747 if(carouselElement.get(0)){ // thumbnails nav can be disabled -mrtkrcm 1748 carouselElement.flexslider({ 1749 animation: "slide", 1750 controlNav: false, 1751 animationLoop: false, 1752 slideshow: false, 1753 itemWidth: sliderElement.data('itemwidth'), 1754 itemMargin: 0, 1755 asNavFor: '#'+elID+' .theSlider' 1756 }); 1757 1758 syncSelector = '#'+elID+' .theCarousel'; 1759 } 1760 1761 sliderElement.flexslider({ 1762 animation: "slide", 1763 controlNav: false, 1764 animationLoop: sliderElement.data('animationloop'), 1765 slideshow: sliderElement.data('slideshow'), 1766 smoothHeight: sliderElement.data('smoothheight'), 1767 slideshowSpeed: sliderElement.data('slideshowspeed'), 1768 pauseOnHover: sliderElement.data('pauseonhover'), 1769 sync: syncSelector 1770 }); 1771 }, 1772 1773 gallery_thumb_lb: function(elID){ 1774 var els = $('#'+elID+' a'); 1775 els.magnificPopup({ 1776 type: 'image', 1777 gallery:{ 1778 enabled: true 1779 }, 1780 image: { 1781 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 1782 titleSrc: function(item) { 1783 var title_string; 1784 1785 if( item.el.data('caption') !== undefined && item.el.data('desc') !== undefined ){ 1786 title_string = item.el.data('caption') + '<small>'+item.el.data('desc')+'</small>'; 1787 }else if( item.el.data('caption') !== undefined && item.el.data('desc') == undefined ){ 1788 title_string = item.el.data('caption'); 1789 } 1790
1791 return title_string; 1792 } 1793 } 1794 }); 1795 }, 1796 1797 gallery_thumb_grid_2: function(elID){ 1798 var el = $('#'+elID), 1799 bigs = el.find('.big_caption'), 1800 smalls = el.find('.met_gallery_thumb_grid'), 1801 autoInterval, 1802 slideshow = el.data('slideshow'), 1803 pauseTime = el.data('pause'), 1804 speedTime = el.data('speed'); 1805 1806 bigs.find('a').magnificPopup({ 1807 type: 'image', 1808 gallery:{ 1809 enabled: true 1810 }, 1811 image: { 1812 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 1813 titleSrc: function(item) { 1814 var title_string; 1815 1816 if( item.el.data('caption') !== undefined && item.el.data('desc') !== undefined ){ 1817 title_string = item.el.data('caption') + '<small>'+item.el.data('desc')+'</small>'; 1818 }else if( item.el.data('caption') !== undefined && item.el.data('desc') == undefined ){ 1819 title_string = item.el.data('caption'); 1820 } 1821 1822 return title_string; 1823 } 1824 } 1825 }); 1826 1827 1828 // Set First Items as Active 1829 el.find('li:first-child').addClass('activeItem'); 1830 1831 function setActiveImage(id){ 1832 var currentBigItem = bigs.find('.activeItem'), 1833 currentSmallItem = smalls.find('.activeItem'), 1834 1835 nextBigItem = id == undefined ? (!currentBigItem.next().get(0) ? bigs.find('li').eq(0) : currentBigItem.next()) : bigs.find('li').eq(id), 1836 nextSmallItem = id == undefined ? (!currentSmallItem.next().get(0) ? smalls.find('li').eq(0) : currentSmallItem.next()) : smalls.find('li').eq(id); 1837 1838 currentBigItem.removeClass('activeItem').hide(); 1839 nextBigItem.addClass('activeItem').fadeIn(speedTime); 1840 1841 currentSmallItem.removeClass('activeItem'); 1842 nextSmallItem.addClass('activeItem'); 1843 } 1844 1845 function setTimer(){autoInterval = setInterval(function(){setActiveImage()},pauseTime);} 1846 1847 smalls.find('li').click(function(){ 1848 if(!$(this).hasClass('activeItem')){ 1849 clearInterval(autoInterval); 1850 setActiveImage($(this).index()); 1851 } 1852 }); 1853 1854 if(slideshow){ 1855 el.mouseenter(function(){clearInterval(autoInterval)}); 1856 el.mouseleave(function(){setTimer()}); 1857 1858 setTimer(); 1859 } 1860 }, 1861 1862 imageCarousel: function(elemID){ 1863 var met_image_carousel = $('#'+elemID), 1864 maxSlides = met_image_carousel.data('mode') == 'fade' ? 1 : met_image_carousel.data('maximumvisible'); 1865 met_image_carousel.each(function(){ 1866 var e = $(this); 1867 var s = e.bxSlider({ 1868 mode: met_image_carousel.data('mode'), 1869 slideMargin: 0, 1870 slideWidth: met_image_carousel.data('width'), 1871 speed: met_image_carousel.data('speed'), 1872 startSlide: met_image_carousel.data('startslide'), 1873 randomStart: met_image_carousel.data('randomstart'), 1874 infiniteLoop: met_image_carousel.data('infiniteloop'), 1875 pager: false, 1876 controls: false, 1877 auto: met_image_carousel.data('autoslide'), 1878 pause: met_image_carousel.data('pause'), 1879 autoDirection: met_image_carousel.data('slidedirection'), 1880 autoHover: met_image_carousel.data('hoveroverstop'), 1881 minSlides: met_image_carousel.data('minimumvisible'), 1882 maxSlides: maxSlides, 1883 moveSlides: met_image_carousel.data('moveslides') 1884 }); 1885 if(e.parents('.met_image_carousel_wrap').get(0)){ 1886 e.parents('.met_image_carousel_wrap').find('.previous').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1887 e.parents('.met_image_carousel_wrap').find('.next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1888 }else if(e.parents('.met_image_carousel_wrap_2').get(0)){ 1889 e.parents('.met_image_carousel_wrap_2').find('.previous').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1890 e.parents('.met_image_carousel_wrap_2').find('.next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1891 }else if(e.parents('.met_image_carousel_wrap_3').get(0)){ 1892 e.parents('.met_image_carousel_wrap_3').find('.previous').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1893 e.parents('.met_image_carousel_wrap_3').find('.next').click(function(e){e.preventDefault();s.goToNextSlide()}); 1894 } 1895 1896 }); 1897 }, 1898 1899 teamlistHoverControls: function(elID){ 1900 var member = $('#'+elID+' .met_teamlist_member'); 1901 if(member.get(0)){ 1902 var timeOut; 1903 var firstIndex = member.parent().find('.on').index() + 1; 1904 member.parent().next().children(':nth-child('+firstIndex+')').show(); 1905 1906 member.hover(function(){ 1907 clearTimeout(timeOut); 1908 var $this = $(this); 1909 var parent = $this.parent(); 1910 if(!$this.hasClass('on')){ 1911 timeOut = setTimeout(function(){ 1912 var oldIndex = parent.find('.on').index() + 1; 1913 parent.next().children(':nth-child('+oldIndex+')').hide(); 1914 parent.find('.on').removeClass('on'); 1915 1916 var newIndex = $this.index() + 1; 1917 parent.next().children(':nth-child('+newIndex+')').fadeIn(300); 1918 $this.addClass('on'); 1919 },300); 1920 } 1921 }); 1922 } 1923 }, 1924 1925 testimonialHoverControls: function(){ 1926 var testimonialInterval; 1927 if($('.met_testimonial_photos').get(0)){ 1928 $('.met_testimonial_photos > div').hover(function(){ 1929 var e = $(this); 1930 testimonialInterval = setInterval(function(){CoreJS.testimonialHoverOver(e)},600); 1931 },function(){ 1932 var e = $(this); 1933 testimonialInterval = clearInterval(testimonialInterval); 1934 CoreJS.testimonialHoverOut(e); 1935 }); 1936 } 1937 }, 1938 1939 testimonialHoverOver: function(i){ 1940 var id = i.index() + 1; 1941 i.parents('.met_testimonial_photos').next().children('div:nth-child('+id+')').slideDown(); 1942 }, 1943 1944 testimonialHoverOut: function(e){ 1945 var id = e.index() + 1; 1946 e.parents('.met_testimonial_photos').next().children('div:nth-child('+id+')').slide
1946Up(); 1947 }, 1948 1949 // Flickr Feed Controls 1950 flickrfeed: function(id) { 1951 var flickr_feed = jQuery('#'+id); 1952 if(flickr_feed.get(0)){ 1953 flickr_feed.jflickrfeed({ 1954 limit: flickr_feed.data('limit'), 1955 qstrings: { 1956 id: flickr_feed.data('id') 1957 }, 1958 itemTemplate: '<li><a href="{{image_b}}" rel="lb_flickr" target="_blank"><img src="{{image_s}}" alt="{{title}}" /></a></li>' 1959 }, function(){ 1960 flickr_feed.find('a').magnificPopup({ 1961 type: 'image', 1962 gallery:{ 1963 enabled: true 1964 } 1965 }); 1966 }); 1967 } 1968 }, 1969 1970 // Testimonials 1971 testimonialsRotator: function(elID){ 1972 var met_parallax_testimonials = $("#"+elID); 1973 if(met_parallax_testimonials.get(0)){ 1974 met_parallax_testimonials.each(function(){ 1975 var e = $(this); 1976 var s = e.bxSlider({ 1977 mode: 'fade', 1978 slideMargin: 0, 1979 speed: 500, 1980 pager: false, 1981 controls: false, 1982 auto: true, 1983 pause: 4000, 1984 autoHover: true, 1985 minSlides: 1, 1986 maxSlides: 1, 1987 moveSlides: 1 1988 }); 1989 e.parents('.dslc-modules-section').find('.met_testimonials_controls a:first-child').click(function(e){e.preventDefault();s.goToPrevSlide()}); 1990 e.parents('.dslc-modules-section').find('.met_testimonials_controls a:last-child').click(function(e){e.preventDefault();s.goToNextSlide()}); 1991 }); 1992 } 1993 }, 1994 1995 // Retina 1996 retina: function(){ 1997 if (window.devicePixelRatio > 1) { 1998 jQuery('[data-retina]').each(function(){ 1999 if(jQuery(this).attr('data-retina') != ''){ 2000 jQuery(this).attr('src', jQuery(this).attr('data-retina')); 2001 } 2002 }); 2003 } 2004 }, 2005 2006 // Windmill Carousel Trigger 2007 windmillCarouselTrigger: function(elemID, textBox, autoPlay, autoPlayDirection){ 2008 var entrance = 'BLL', 2009 exit = 'TRU', 2010 head = 'TR', 2011 body = 'TL', 2012 foot = 'BL'; 2013 2014 switch(textBox){ 2015 case 'BR':break; 2016 case 'TL': 2017 entrance = 'BLL', 2018 exit = 'TRR', 2019 head = 'TR', 2020 body = 'BR', 2021 foot = 'BL'; 2022 break; 2023 case 'TR': 2024 entrance = 'TLL', 2025 exit = 'BRD', 2026 head = 'BR', 2027 body = 'BL', 2028 foot = 'TL'; 2029 break; 2030 case 'BL': 2031 entrance = 'TLL', 2032 exit = 'BRD', 2033 head = 'BR', 2034 body = 'TR', 2035 foot = 'TL'; 2036 break; 2037 } 2038 2039 var el = $('#'+elemID); 2040 el.imagesLoaded(function(){ 2041 el.windmillCarousel({ 2042 textBox: el.data('textcontentposition'), 2043 entrance: entrance, 2044 exit: exit, 2045 head: head, 2046 body: body, 2047 foot: foot, 2048 autoPlay: el.data('autoplaytime'), 2049 autoPlayDirection: el.data('autoplaydirection') 2050 }); 2051 }); 2052 }, 2053 2054 filterInBreadcrumb: function(isotopeID){ 2055 var met_portfolio_filters_wrap = $('.'+isotopeID+'_filters_bind'); 2056 if(met_portfolio_filters_wrap.get(0)){ 2057 met_portfolio_filters_wrap.hover(function(){ 2058 met_portfolio_filters_wrap.children('ul').hide().stop(true).slideDown(); 2059 },function(){ 2060 met_portfolio_filters_wrap.children('ul').stop(true).slideUp(); 2061 }); 2062 } 2063 }, 2064 2065 insertFilterInBreadcrumb: function(isotopeID, categories, place){ 2066 var stack = categories.split('(split)'), 2067 parts = new Array(), 2068 html; 2069 2070 for (var i = 0; i < stack.length; ++i) { 2071 parts[i] = stack[i].split('//'); 2072 } 2073 2074 if(place == 'on_breadcrumb'){ 2075 html = '<div class="'+isotopeID+'_filters_bind '+isotopeID+'_filters met_portfolio_filters_wrap met_bgcolor"><span>'+parts[0][0]+'</span><i class="fa fa-caret-down"></i><ul class="met_clean_list met_bgcolor filters"><li><a href="#" class="activePortfolio" data-filter="'+parts[0][1]+'">'+parts[0][0]+'</a></li>'; 2076 for (var i = 1; i < parts.length-1; ++i) { 2077 html += '<li><a href="#" data-filter=".'+parts[i][1]+'">'+parts[i][0]+'</a></li>'; 2078 } 2079 html += '</ul></div>'; 2080 }else{ 2081 html = '<ul class="'+isotopeID+'_filters_bind '+isotopeID+'_filters met_filters clearfix"><li><a href="#" class="activePortfolio" data-filter="'+parts[0][1]+'">'+parts[0][0]+'</a></li>'; 2082 for (var i = 1; i < parts.length-1; ++i) { 2083 html += '<li><a href="#" data-filter=".'+parts[i][1]+'">'+parts[i][0]+'</a></li>'; 2084 } 2085 html += '</ul>'; 2086 } 2087 2088 var filterOnBreadCrumb = $('[class*="_filters_bind"]:not(.met_filters)'); 2089 if(filterOnBreadCrumb.get(0)) filterOnBreadCrumb.remove(); 2090 if(place == 'on_breadcrumb'){ 2091 if($('.met_page_head').get(0)){ 2092 $('.met_page_head h1').after(html); 2093 CoreJS.filterInBreadcrumb(isotopeID); 2094 } 2095 }else{ 2096 $('#'+isotopeID).before(html); 2097 } 2098 2099 }, 2100 2101 met_accordion: function(elID){ 2102 $('#' + elID + ' .on .met_accordion_content').slideDown(400); 2103 $('#' + elID + ' .met_accordion_title').bind('click', function(e){ 2104 e.preventDefault(); 2105 var group = $(this).parents('.met_accordion_group'), 2106 accordion = $(this).parent(), 2107 active; 2108 2109 if(!accordion.hasClass('on')){ 2110 active = group.find('.on'); 2111 active.removeClass('on'); 2112 active.find('.met_accordion_content').slideUp(400); 2113 2114 accordion.addClass('on'); 2115 accordion.find('.met_accordion_content').slideDown(400); 2116 }else{ 2117 accordion.removeClass('on'); 2118 accordion.find('.met_accordion_content').slideUp(400); 2119 } 2120 }); 2121 }, 2122 2123 avatar_testimonials: function(elID){ 2124 var el = $('#'+elID),
2125 hovers = el.find('.met_testimonial_3_photos > div'); 2126 2127 testimonialHoverOver(hovers.first()); 2128 2129 hovers.hover(function(){ 2130 var newHover = jQuery(this); 2131 if( !newHover.hasClass('hovered') ){ 2132 var oldHover = el.find('.hovered'); 2133 testimonialHoverOut(oldHover); 2134 testimonialHoverOver(newHover); 2135 } 2136 }); 2137 2138 function testimonialHoverOver(i){ 2139 var id = i.index() + 1; 2140 2141 i.addClass('hovered'); 2142 i.parents('.met_testimonial_3_photos').next().children('div:nth-child('+id+')').stop().fadeIn(400); 2143 } 2144 2145 function testimonialHoverOut(e){ 2146 var id = e.index() + 1; 2147 2148 e.removeClass('hovered'); 2149 e.parents('.met_testimonial_3_photos').next().children('div:nth-child('+id+')').hide(); 2150 } 2151 }, 2152 2153 setCountDown: function(elID,arr){ 2154 var el = $("#"+elID); 2155 if(arr == null){ 2156 var arr = new Array(); 2157 arr['day'] = el.data('day'), 2158 arr['month'] = el.data('month'), 2159 arr['year'] = el.data('year'), 2160 arr['hour'] = el.data('hour'), 2161 arr['minute'] = el.data('minute'), 2162 arr['second'] = el.data('second'); 2163 } 2164 el.countEverest({ 2165 day: arr['day'], 2166 month: arr['month'], 2167 year: arr['year'], 2168 hour: arr['hour'], 2169 minute: arr['minute'], 2170 second: arr['second'], 2171 daysLabel: el.data('dayslabel'), 2172 dayLabel: el.data('daylabel'), 2173 hoursLabel: el.data('hourslabel'), 2174 hourLabel: el.data('hourlabel'), 2175 minutesLabel: el.data('minuteslabel'), 2176 minuteLabel: el.data('minutelabel'), 2177 secondsLabel: el.data('secondslabel'), 2178 secondLabel: el.data('secondlabel') 2179 2180 }); 2181 }, 2182 2183 pieChart: function(elID){ 2184 var el = $('#'+elID); 2185 2186 el.easyPieChart({ 2187 lineWidth: el.data('linewidth'), 2188 size: el.data('size'), 2189 barColor: el.data('barcolor'), 2190 trackColor: el.data('trackcolor'), 2191 scaleColor: 'transparent', 2192 lineCap: 'square' 2193 }); 2194 2195 el.appear(function(){ 2196 if(!el.hasClass('animated')){ 2197 el.addClass('animated'); 2198 el.data('easyPieChart').update(el.data('animatepercent')); 2199 2200 if(el.find('.countTo').get(0)){ 2201 el.find('.countTo').countTo(); 2202 } 2203 } 2204 }); 2205 }, 2206 2207 countTo: function(elID){ 2208 var el = $('#' + elID); 2209 2210 el.appear(function(){ 2211 if(!el.hasClass('counted')){ 2212 el.addClass('counted'); 2213 el.find('.countTo').countTo(); 2214 } 2215 }); 2216 }, 2217 2218 appearThis: function(elID){ 2219 var el = $('#'+elID); 2220 2221 el.appear(function(){ 2222 if(!el.hasClass('animated')){ 2223 el.addClass('animated'); 2224 } 2225 }); 2226 }, 2227 2228 contactMap: function(elID, latLng, hiddenFirst,style_js_array){ 2229 function HomeControl(controlDiv, map, center) { 2230 2231 // Zoom Controls 2232 google.maps.event.addDomListener(zoomout, 'click', function() { 2233 var currentZoomLevel = map.getZoom(); 2234 if(currentZoomLevel != 0){ 2235 map.setZoom(currentZoomLevel - 1);} 2236 }); 2237 2238 google.maps.event.addDomListener(zoomin, 'click', function() { 2239 var currentZoomLevel = map.getZoom(); 2240 if(currentZoomLevel != 21){ 2241 map.setZoom(currentZoomLevel + 1);} 2242 }); 2243 2244 // Pan Controls 2245 google.maps.event.addDomListener(panup, 'click', function() { 2246 map.panBy(0,-150); 2247 }); 2248 2249 google.maps.event.addDomListener(panright, 'click', function() { 2250 map.panBy(150,0); 2251 }); 2252 2253 google.maps.event.addDomListener(panbottom, 'click', function() { 2254 map.panBy(0,150); 2255 }); 2256 2257 google.maps.event.addDomListener(panleft, 'click', function() { 2258 map.panBy(-150,0); 2259 }); 2260 2261 google.maps.event.addDomListener(pancenter, 'click', function() { 2262 map.panTo(center); 2263 }); 2264 2265 } 2266 function initialize() { 2267 2268 var mapDiv = document.getElementById(elID); 2269 var myLatlng = markerLocations[0]; 2270 var mapOptions = { 2271 zoom: $('#'+elID).data('zoom'), 2272 center: myLatlng, 2273 Marker: true, 2274 panControl: false, 2275 zoomControl: false, 2276 streetViewControl: false, 2277 overviewMapControl: false, 2278 mapTypeControl: false, 2279 scrollwheel: false, 2280 draggable: false, 2281 mapTypeId: google.maps.MapTypeId.ROADMAP, 2282 styles: style_js_array 2283 } 2284 2285 map = new google.maps.Map(mapDiv, mapOptions); 2286 var homeControlDiv = document.createElement('div'); 2287 var homeControl = new HomeControl(homeControlDiv, map, myLatlng); 2288 2289 if(hiddenFirst != ''){ 2290 google.maps.event.addListenerOnce(map, 'idle', function() { 2291 $('#'+elID).parent().slideUp(0); 2292 }); 2293 } 2294 2295 drop(); 2296 2297 } 2298 2299 function drop() { 2300 for (var i = 1;
2300 i <= markerLocations.length; i++) { 2301 setTimeout(function() { 2302 addMarker(); 2303 }, i * 500); 2304 } 2305 } 2306 2307 function addMarker() { 2308 markers.push(new google.maps.Marker({ 2309 position: markerLocations[iterator], 2310 map: map, 2311 draggable: false, 2312 //icon: 'img/map-marker.png', 2313 animation: google.maps.Animation.DROP 2314 })); 2315 iterator++; 2316 } 2317 2318 if($('#'+elID).get(0)){ 2319 var map; 2320 var markers = latLng.split(','); 2321 var iterator = 0; 2322 2323 var markerLocations = [ 2324 new google.maps.LatLng(markers[0], markers[1]) 2325 ]; 2326 2327 google.maps.event.addDomListener(window, 'load', initialize); 2328 2329 } 2330 }, 2331 2332 sideNavbar: function(){ 2333 function setSideNavbarHeight(){ 2334 if($(window).width() < 1025) return false; 2335 var sideNavbarWrap = $('.met_side_navbar_wrap'), 2336 bodyHeight = $('body').height(), 2337 windowHeight = $(window).height(); 2338 2339 2340 if(parseInt(sideNavbarWrap.attr('data-height')) != bodyHeight){ 2341 var adminBar = $('#wpadminbar'), 2342 adminBarH = !adminBar.get(0) ? 0 : adminBar.height(); 2343 2344 bodyHeight = bodyHeight < windowHeight ? windowHeight - adminBarH : bodyHeight; 2345 2346 sideNavbarWrap.attr('data-height', bodyHeight); 2347 sideNavbarWrap.css({ 2348 top: adminBarH + 'px', 2349 height: bodyHeight + 'px' 2350 }); 2351 } 2352 } 2353 2354 2355 $('.met_side_navbar .met_primary_nav li.menu-item.met_primary_nav_mega').each(function(){ 2356 var ul = $(this).children('ul'), 2357 max_width = parseInt(ul.css('max-width')), 2358 calculated = ul.children('li').length * ul.children('li').outerWidth(), 2359 wrapWidth = calculated > max_width || ul.hasClass('mmm-sub-menu-is-full-width') ? max_width : calculated; 2360 2361 ul.css('width', wrapWidth + 'px'); 2362 }); 2363 2364 $('.met_side_navbar .met_primary_nav li.menu-item.met_primary_nav_posts').each(function(){ 2365 var ul = $(this).children('ul'), 2366 max_width = parseInt(ul.css('max-width')), 2367 calculated = ul.children('li').length * ul.children('li').outerWidth(true) + parseInt( ul.children('li').css('margin-left') ), 2368 wrapWidth = calculated > max_width ? max_width : calculated; 2369 2370 ul.css('width', wrapWidth + 'px'); 2371 }); 2372 2373 $('.met_side_navbar .met_primary_nav li.menu-item.met_primary_nav_mega_posts').each(function(){ 2374 var ul = $(this).children('ul'), 2375 max_width = parseInt(ul.css('max-width')); 2376 2377 ul.css('width', max_width + 'px'); 2378 }); 2379 2380 $(window).on('load', function(){setTimeout(setSideNavbarHeight, 250)}); 2381 $(window).on('debouncedresize', setSideNavbarHeight); 2382 }, 2383 2384 // Internet Explorer Version Checker 2385 ie: function(){ 2386 var undef, 2387 v = 3, 2388 div = document.createElement('div'), 2389 all = div.getElementsByTagName('i'); 2390 2391 while ( 2392 div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', 2393 all[0] 2394 ); 2395 2396 return v > 4 ? v : undef; 2397 } 2398 2399 2400 2401 }; 2402 2403 CoreJS.initialize(); 2404 2405})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.