1/** 2 * Salient Portfolio. 3 * 4 * @author ThemeNectar 5 */ 6 /* global Waypoint */ 7 /* global imagesLoaded */ 8 /* global nectar_theme_info */ 9 10 (function( $ ) { 11 12 "use strict"; 13 14 /*-------------------------------------------------------------------------*/ 15 /* 1. Salient Portfolio Element 16 /*-------------------------------------------------------------------------*/ 17 18 function SalientPortfolio(el, fullWidthContentColumns, fullscreenSelector, fullWidthSections) { 19 20 this.$el = el; 21 this.fullWidthContentColumns = fullWidthContentColumns; 22 this.fullWidthSections = fullWidthSections; 23 24 this.$window = $(window); 25 this.onMobile = false; 26 this.clearIsoAnimation = null; 27 this.mediaQuerySize = ''; 28 this.fullscreenSelector = fullscreenSelector; 29 this.initialized = false; 30 this.total = 0; 31 this.totalLoaded = 0; 32 33 this.mouseEventHandler(); 34 this.portfolioFiltersInit(); 35 this.portfolioInit(); 36 this.resizeHandler(); 37 38 if( this.$el.find('.inner-wrap[data-animation="perspective"]').length > 0) { 39 this.perspectiveAnimationInit(); 40 } 41 42 this.portfolioAccentColor(); 43 this.isotopeCatSelection(); 44 this.portfolioCommentOrder(); 45 46 } 47 48 SalientPortfolio.prototype.portfolioInit = function() { 49 50 var that = this; 51 52 this.total = this.$el.find('img').length; 53 54 // Lazy loading gallery 55 if( this.$el.parents('.wpb_gallery').length > 0 && this.$el.find('.nectar-lazy').length > 0 ) { 56 57 this.fullWidthSections(); 58 59 // Set image sizes 60 this.$el.find('img.nectar-lazy:not(.loaded)').each(function() { 61 62 $(this).css({ 63 'height': '', 64 'width' : '' 65 }); 66 67 var heightAttr = parseInt($(this).attr('height')); 68 var widthAttr = parseInt($(this).attr('width')); 69 var width = $(this).width(); 70 var dimensions = that.imageAspectRatio( widthAttr, heightAttr, width, 2000 ); 71 72 $(this).css({ 73 'height': dimensions.height + 'px', 74 'width' : dimensions.width + 'px' 75 }); 76 77 }); 78 79 // Start masonry 80 this.masonryInit('0s'); 81 this.initialized = true; 82 83 // Image loading progress. 84 $(window).on('salient-portfolio-recalculate', this.imageLoadLayout.bind(this) ); 85 86 } 87 // Regular Portfolio. 88 else { 89 this.$el.imagesLoaded(function(){ 90 that.masonryInit('0.6s'); 91 that.initialized = true; 92 }); 93 } 94 }; 95 96 SalientPortfolio.prototype.imageLoadLayout = function() { 97 this.totalLoaded = this.totalLoaded + 1; 98 99 if( this.initialized == true && this.totalLoaded % 4 == 0 ) { 100 this.$el.isotope('layout'); 101 } 102 }; 103 104 SalientPortfolio.prototype.imageAspectRatio = function(srcWidth, srcHeight, maxWidth, maxHeight) { 105 var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); 106 return { width: srcWidth*ratio, height: srcHeight*ratio }; 107 } 108 109 SalientPortfolio.prototype.masonryInit = function(transitionDur) { 110 111 var instance = this; 112 113 // initial call to setup isotope. 114 if (typeof instance.$el.isotope === 'function') { 115 116 var $layoutMode = ( instance.$el.hasClass('masonry-items')) ? 'packery' : 'fitRows'; 117 var $startingFilter = (instance.$el.attr('data-starting-filter') != '' && instance.$el.attr('data-starting-filter') != 'default') ? '.' + instance.$el.attr('data-starting-filter') : '*'; 118 var $rtlLayout = ( $('body.rtl').length > 0 ) ? false : true; 119 120 instance.beforeReLayout(); 121 instance.$el.addClass('isotope-activated'); 122 123 instance.$el.isotope({ 124 itemSelector : '.portfolio-items', 125 filter: $startingFilter, 126 layoutMode: $layoutMode, 127 transitionDuration: transitionDur, 128 isOriginLeft: $rtlLayout, 129 equalheight: true, 130 fitRows: { 131 equalheight: true 132 } 133 }).isotope('layout'); 134 135} 136 137 138 139 // Starting filters. 140 if($startingFilter != '*'){ 141 142 // Custom starting filter. 143 if( instance.$el.parent().parent().find('.portfolio-filters').length > 0 ) { 144 instance.$el.parent().parent().find('.portfolio-filters ul a[data-filter="'+$startingFilter+'"]').trigger('click'); 145 } else { 146 instance.$el.parent().parent().find('.portfolio-filters-inline ul a[data-filter="'+$startingFilter+'"]').trigger('click'); 147 } 148 149 } else { 150 151 // Default filter of "all". 152 if(instance.$el.parent().parent().find('.portfolio-filters-inline[data-alignment="left"]').length > 0 || 153 instance.$el.parent().parent().find('.portfolio-filters-inline[data-alignment="center"]').length > 0) { 154 instance.$el.parent().parent().find('.portfolio-filters-inline .container > ul > li:nth-child(1) a').trigger('click').addClass('active'); 155 } else { 156 instance.$el.parent().parent().find('.portfolio-filters-inline .container > ul > li:nth-child(2) a').trigger('click').addClass('active'); 157 } 158 159 } 160 161 162 if(instance.$el.find('.inner-wrap').attr('data-animation') === 'none') { 163 instance.$el.find('.inner-wrap').removeClass('animated'); 164 } 165 166 instance.loadAnimationWaypoint(); 167 $(window).on('nectar-waypoints-reinit', instance.loadAnimationWaypoint.bind(instance)); 168 169 // Call the reLayout to get things rollin'. 170 instance.masonryZindex(); 171 var self = this; 172 setTimeout(function(){ instance.masonryZindex(); },800); 173 174 // Inside full width content. 175 if(instance.$el.parents('.full-width-content').length > 0) { 176 setTimeout(function(){ instance.fullWidthContentColumns(); },200); 177 } 178 179 // fadeout the loading animation 180 $('.portfolio-loading').stop(true,true).fadeOut(200); 181 182 183 }; 184 185 186 SalientPortfolio.prototype.resizeHandler = function(){ 187 188 var self = this; 189 190 this.$window.on('resize', function(){ 191 192 setTimeout(function(){ 193 self.reLayout(); 194 self.masonryZindex(); 195 self.portfolioCommentOrder(); 196 },30); 197 198 }); 199 200 }; 201 202 203 SalientPortfolio.prototype.mouseEventHandler = function() { 204 205 // sorting 206 if( this.$el.parent().parent().find('.portfolio-filters').length > 0 ) { 207 this.$el.parent().parent().find('.portfolio-filters ul li a').on('click', this.isoClickFilter.b
207ind(this)); 208 } else { 209 this.$el.parent().parent().find('.portfolio-filters-inline ul li a').on('click', this.isoClickFilter.bind(this)); 210 } 211 212 if( $('body.page-template-template-portfolio').length > 0 && $('#page-header-wrap .portfolio-filters').length > 0 ) { 213 $('#page-header-wrap .portfolio-filters ul li a').on('click', this.isoClickFilter.bind(this)); 214 } 215 216 // portfolio sort 217 $('body').on('mouseenter','.portfolio-filters',function(){ 218 if(!this.onMobile) { 219 $(this).find('> ul').stop(true,true).slideDown(500,'easeOutExpo'); 220 } 221 $(this).find('a#sort-portfolio span').html($(this).find('a#sort-portfolio').attr('data-sortable-label')); 222 }); 223 224 $('body').on('mouseleave','.portfolio-filters',function(){ 225 var $activeCat = $(this).find('a.active').html(); 226 if( typeof $activeCat == 'undefined' || $activeCat.length == 0) { 227 $activeCat = $(this).attr('data-sortable-label'); 228 } 229 230 $(this).find('a#sort-portfolio span').html($activeCat); 231 232 if(!this.onMobile) { 233 $(this).find('> ul').stop(true,true).slideUp(500,'easeOutExpo'); 234 } 235 }); 236 237 // portfolio selected category 238 $('body').on('click','.portfolio-filters ul li a', function(){ 239 $(this).parents('.portfolio-filters').find('#sort-portfolio span').html($(this).html()); 240 }); 241 242 // portfolio prevent jump on parent dropdown click 243 $('body').on('click','.portfolio-filters > a#sort-portfolio', function(){ 244 return false; 245 }); 246 247 // portfolio description remove on hover 248 var $tmpTitle = ''; 249 $('.portfolio-items > .col a[title]').on('mouseenter', function () { 250 if( $(this).attr('title').length > 0 ) { 251 $tmpTitle = $(this).attr('title'); 252 $(this).attr('title', ''); 253 } 254 }); 255 $('.portfolio-items > .col a[title]').on('mouseleave', function () { 256 if( $tmpTitle.length > 0 ) { 257 $(this).attr('title', $tmpTitle); 258 } 259 }); 260 261 $('.portfolio-items > .col a[title]').on('mousedown', function () { 262 if( $tmpTitle.length > 0 ) { 263 $(this).attr('title', $tmpTitle); 264 } 265 }); 266 267 268 }; 269 270 271 SalientPortfolio.prototype.portfolioFiltersInit = function() { 272 273 // Mobile sort menu 274 if( $('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/) ) { 275 276 this.onMobile = true; 277 278 $('body').off('mouseenter mouseleave', '.portfolio-filters'); 279 280 this.$el.parent().parent().find('.portfolio-filters > a').on('click',function(e) { 281 if(e.originalEvent !== undefined) { 282 $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic'); 283 } 284 }); 285 286 this.$el.parent().parent().find('.portfolio-filters ul li a').on('click',function(e) { 287 if(e.originalEvent !== undefined) { 288 $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic'); 289 290 var $activeCat = $(this).html(); 291 $(this).parents('.portfolio-filters').find('a#sort-portfolio span').html($activeCat); 292 293 } 294 }); 295 296 } 297 298 // portfolio more details page menu highlight 299 $('body.single-portfolio #header-outer nav > ul > li > a:contains("Portfolio")').parents('li').addClass('current-menu-item'); 300 301 // Portfolio external links. 302 $(".portfolio-items").find("a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 303 $(".recent_projects_widget").find("a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 304 305 $(".portfolio-items").find("a[href*='https://']:not([href*='" + window.location.hostname + "']):not([href*='youtube.com']):not([href*='vimeo.com'])").attr("target", "_blank"); 306 $(".recent_projects_widget").find("a[href*='https://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); 307 308 }; 309 310 311 312 SalientPortfolio.prototype.isoClickFilter = function(e) { 313 314 var $timeout; 315 var self = this; 316 317 if(window.innerWidth > 690 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 318 319 clearTimeout($timeout); 320 $timeout = setTimeout(function(){ self.masonryZindex(); },600); 321 322 } 323 324 var selector = $(e.target).attr('data-filter'); 325 326 this.$el.isotope({ filter: selector }).attr('data-current-cat',selector); 327 328 // fade in all incase user hasn't scrolled down yet 329 if(this.$el.find('.inner-wrap[data-animation="none"]').length === 0) { 330 this.$el.find('.col').addClass('animated-in'); 331 } 332 333 // active classes 334 $(e.target).closest('ul:not(.children)').find('li a').removeClass('active'); 335 $(e.target).addClass('active'); 336 337 if($(e.target).parents('.portfolio-filters-inline').length > 0) { 338 $(e.target).parents('.portfolio-filters-inline').find('#current-category').html($(e.target).html()); 339 } 340 341 // update pp 342 if(this.$el.find('a[rel^="prettyPhoto"]').length > 0) { 343 setTimeout(this.updatePrettyPhotoGallery.bind(this),170); 344 } 345 346 else { 347 setTimeout(this.updateMagPrettyPhotoGallery.bind(this),170); 348 } 349 350 // Resize. 351 if (typeof window.Waypoint != 'undefined') { 352 Waypoint.refreshAll(); 353 } 354 355 return false;
356 }; 357 358 359 360 SalientPortfolio.prototype.loadAnimationWaypoint = function() { 361 362 363 var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%'; 364 var instance = this; 365 366 if(this.$el.find('.inner-wrap').attr('data-animation') === 'none') { return; } 367 368 this.$el.find('.col').each(function(i) { 369 370 var $that = $(this); 371 372 //loaded visible 373 if($(this).visible(true) || $(this).parents('#nectar_fullscreen_rows').length > 0) { 374 375 if( $(this).parents('#nectar_fullscreen_rows').length > 0 && 376 instance.fullscreenSelector.length > 0 && 377 $(this).parents(instance.fullscreenSelector).length == 0 ) { 378 return true; 379 } 380 381 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 90 : 115; 382 $(this).delay($portfolioAnimationDelay *i).queue(function(next){ 383 $(this).addClass("animated-in"); 384 next(); 385 }); 386 387 } else { 388 389 // not already visible 390 var waypoint = new Waypoint({ 391 element: $that, 392 handler: function() { 393 394 if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') === 'hidden' || $that.hasClass('animated-in')) { 395 waypoint.destroy(); 396 return; 397 } 398 399 var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 100; 400 401 setTimeout(function(){ 402 $that.addClass("animated-in"); 403 },$portfolioAnimationDelay * $that.attr('data-delay-amount')); 404 405 406 waypoint.destroy(); 407 }, 408 offset: $portfolioOffsetPos 409 410 }); //waypoint 411 } 412 413 }); //each 414 415 416 }; 417 418 SalientPortfolio.prototype.perspectiveAnimationInit = function() { 419 420 var lastScrollTop = $(window).scrollTop(); 421 var self = this; 422 423 this.$el.css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px'); 424 425 requestAnimationFrame(updatePerspectiveOrigin); 426 427 function updatePerspectiveOrigin() { 428 429 var scrollTop = $(window).scrollTop(); 430 431 if (lastScrollTop === scrollTop) { 432 requestAnimationFrame(updatePerspectiveOrigin); 433 return; 434 } else { 435 lastScrollTop = scrollTop; 436 self.$el.css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px'); 437 requestAnimationFrame(updatePerspectiveOrigin); 438 } 439 } 440 441 }; 442 443 444 445 446 SalientPortfolio.prototype.portfolioItemWidths = function() { 447 448 var isFullWidth = this.$el.attr('data-col-num') === 'elastic'; 449 450 if(isFullWidth) { 451 452 var $elWidth = Math.floor(this.$el.width()); 453 var $colSize = 4; 454 var $mult = (this.mediaQuerySize === 'one') ? 1 : 2; 455 456 if(this.mediaQuerySize === 'five') { 457 $colSize = 5; 458 } 459 else if(this.mediaQuerySize === 'four') { 460 $colSize = 4; 461 } 462 else if(this.mediaQuerySize === 'three') { 463 $colSize = 3; 464 } 465 else if(this.mediaQuerySize === 'two') { 466 $colSize = 2; 467 } 468 else if(this.mediaQuerySize === 'one') { 469 $colSize = 1; 470 } 471 472 if(this.$el.is('[data-ps="6"]') && $colSize == 5) { 473 $colSize = 4; 474 } 475 476 // photography 477 if( isFullWidth && this.$el.is('[data-masonry-type="photography"]') && !this.$el.hasClass('no-masonry') ) { 478 if(this.mediaQuerySize === 'five') { 479 $colSize = 6; 480 } 481 if(this.mediaQuerySize === 'four') { 482 $colSize = 5; 483 } 484 if(this.mediaQuerySize === 'three') { 485 $colSize = 4; 486 } 487 } 488 489 if( $elWidth % $colSize === 0 ) { 490 this.$el.find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',Math.floor($elWidth/$colSize) +'px'); 491 this.$el.find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',Math.floor($elWidth/$colSize*$mult) +'px'); 492 } else { 493 494 var $loopEndNum = ($(window).width() > 1000) ? 6 : 3; 495 if(this.$el.hasClass('fullwidth-constrained') && $(window).width() > 1000) { 496 $loopEndNum = 4; 497 } 498 499 // find closest number to give 0. 500 for(var i = 1; i<$loopEndNum; i++) { 501 if( ($elWidth - i) % $colSize === 0 ) { 502 this.$el.find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',($elWidth-i)/$colSize +'px'); 503 this.$el.find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',($elWidth-i)/$colSize*$mult +'px'); 504 } 505 } 506 507 } 508 509 } // isFullWidth 510 511 }; 512 513 514 515 SalientPortfolio.prototype.masonryZindex = function() { 516 517 // escape if no browser support 518 if($('body .portfolio-items:not(".carousel") > .col').length > 0 && 519 $('body .portfolio-items:not(".carousel") > .col').offset().left) { 520 521 var self = this; 522 523 $('body .portfolio-items:not(".carousel")').each(function(){ 524 525 var $coords = {}; 526 var $zindexRelation = {}; 527 var $that = $(this); 528 529 $(this).find('> .col').each(function(){ 530 var $itemOffset = $(this).offset(); 531 $itemOffset = $itemOffset.left; 532 533 $coords[$(this).index()] = $itemOffset; 534 $(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20))); 535 }); 536 537 var $corrdsArr = jQuery.map($coords, function (value) { return value; }); 538 539 $corrdsArr = self.removeDuplicates($corrdsArr); 540 $corrdsArr.sort(function(a,b){ return a-b; }); 541 542 for(var i = 0; i < $corrdsArr.length; i++){ 543 $zindexRelation[$corrdsArr[i]] = i; 544 } 545 546 jQuery.each($coords,function(k,v){ 547 548 var $zindex; 549 var $coordCache = v; 550 jQuery.each($zindexRelation,function(k,v){ 551 if($coordCache === k) { 552 $zindex = v; 553 } 554 }); 555 556 $that.find('> .col:eq('+k+')').attr('data-delay-amount',$zindex); 557 }); 558 559 560 }); 561 562 563 564 } 565 566 567 }; 568 569 570 SalientPortfolio.prototype.removeDuplicates = function(inputArray) { 571 var i; 572 var len = inputArray.length; 573 var outputArray = []; 574 var temp = {}; 575 576 for (i = 0; i < len; i++) { 577 temp[inputArray[i]] = 0; 578 } 579 for (i in temp) { 580 outputArray.push(i); 581 } 582 return outputArray; 583 }; 584 585 586 587 SalientPortfolio.prototype.beforeReLayout = function() { 588 589 var self = this; 590 clearTimeout(this.clearIsoAnimation); 591 592 this.$el.find('.col').addClass('no-transition'); 593 594 this.clearIsoAnimation = setTimeout(function(){ 595 self.$el.find('.col').removeClass('no-transition'); 596 },700); 597 598 599 if(window.innerWidth > 1600) { 600 601 if(this.$el.hasClass('fullwidth-constrained')) { 602 if(this.$el.is('[data-masonry-type="photography"]')) { 603 this.mediaQuerySize = 'three'; 604 } else { 605 this.mediaQuerySize = 'four'; 606 } 607 608 } else { 609 if(this.$el.hasClass('constrain-max-cols')) { 610 this.mediaQuerySize = 'four'; 611 } else { 612 this.mediaQuerySize = 'five'; 613 } 614 } 615 616 } else if(window.innerWidth <= 1600 && window.innerWidth > 1300){ 617 618 if(this.$el.hasClass('fullwidth-constrained')) { 619 if(this.$el.is('[data-masonry-type="photography"]')) { 620 this.mediaQuerySize = 'three'; 621 } else { 622 this.mediaQuerySize = 'four'; 623 } 624 } else { 625 this.mediaQuerySize = 'four'; 626 } 627 } else if(window.innerWidth <= 1300 && window.innerWidth > 990){ 628 629 if(this.$el.hasClass('constrain-max-cols')) { 630 this.mediaQuerySize = 'four'; 631 } else { 632 this.mediaQuerySize = 'three'; 633 } 634 635 } else if(window.innerWidth <= 990 && window.innerWidth > 470){ 636 this.mediaQuerySize = 'two'; 637 } else if(window.innerWidth <= 470){ 638 this.mediaQuerySize = 'one'; 639 } 640 641 // boxed 642 if($('#boxed').length > 0) { 643 if(window.innerWidth > 1300){ 644 this.mediaQuerySize = 'four'; 645 } else if(window.innerWidth < 1300 && window.innerWidth > 990){ 646 647 if(this.$el.hasClass('constrain-max-cols')) { 648 this.mediaQuerySize = 'four'; 649 } else { 650 this.mediaQuerySize = 'three'; 651 } 652 653 } else if(window.innerWidth < 990){ 654 this.mediaQuerySize = 'one'; 655 } 656 657 } 658 659 660 // set widths 661 this.portfolioItemWidths(); 662 663 664 // sizing for large items 665 if(!this.$el.is('[data-bypass-cropping="true"]')) { 666 667 if( this.$el.find('.col.elastic-portfolio-item[class*="regular"]:visible').length > 0 || 668 this.$el.find('.col.elastic-portfolio-item[class*="wide"]:visible').length > 0 || 669 this.$el.find('.col.elastic-portfolio-item[class*="tall"]:visible').length > 0 || 670 this.$el.find('.col.elastic-portfolio-item[class*="wide_tall"]:visible').length > 0) { 671 672 var $gutterSize = (this.$el.is('[data-gutter*="px"]') && this.$el.attr('data-gutter').length > 0 && this.$el.attr('data-gutter') != 'none') ? parseInt(this.$el.attr('data-gutter')) : 0; 673 var multipler = (window.innerWidth > 470) ? 2 : 1; 674 675 // reset height for calcs 676 var $itemClassForSizing = 'regular'; 677 678 if(this.$el.find('.col.elastic-portfolio-item[class*="regular"]:visible').length === 0 && 679 this.$el.find('.col.elastic-portfolio-item.wide:visible').length > 0) { 680 681 $itemClassForSizing = 'wide'; 682 683 } else if(this.$el.find('.col.elastic-portfolio-item[class*="regular"]:visible').length === 0 && 684 this.$el.find('.col.elastic-portfolio-item.wide_tall:visible').length > 0) { 685 686 $itemClassForSizing = 'wide_tall'; 687 multipler = 1; 688 689 } else if(this.$el.find('.col.elastic-portfolio-item[class*="regular"]:visible').length === 0 && 690 this.$el.find('.col.elastic-portfolio-item.tall:visible').length > 0) { 691 692 $itemClassForSizing = 'tall'; 693 multipler = 1; 694 695 } 696 697 this.$el.find('.col.elastic-portfolio-item.'+$itemClassForSizing+' img').css('height','auto'); 698 699 var tallColHeight = this.$el.find('.col.elastic-portfolio-item.'+$itemClassForSizing+':visible img').height(); 700 701 this.$el.find('.col.elastic-portfolio-item[class*="tall"] img, .col.elastic-portfolio-item.wide img, .col.elastic-portfolio-item.regular img').removeClass('auto-height'); 702 this.$el.find('.col.elastic-portfolio-item[class*="tall"] img:not(.custom-thumbnail)').css('height',(tallColHeight*multipler) + ($gutterSize*2)); 703 704 if($itemClassForSizing === 'regular' || $itemClassForSizing === 'wide') { 705 this.$el.find('.col.elastic-portfolio-item.wide img:not(.custom-thumbnail), .col.elastic-portfolio-item.regular img:not(.custom-thumbnail)').css('height',tallColHeight); 706 } else { 707 this.$el.find('.col.elastic-portfolio-item.wide img:not(.custom-thumbnail), .col.elastic-portfolio-item.regular img:not(.custom-thumbnail)').css('height',(tallColHeight/2) - ($gutterSize*2)); 708 } 709 710 this.$el.find('.col.elastic-portfolio-item[class*="tall"] .parallaxImg').css('height',(tallColHeight*multipler) + parseInt(this.$el.find('.col.elastic-portfolio-item').css('padding-bottom'))*2 ); 711 712 if($itemClassForSizing === 'regular' || $itemClassForSizing === 'wide') { 713 this.$el.find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',tallColHeight); 714 } else { 715 this.$el.find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',(tallColHeight/2) - ($gutterSize*2)); 716 } 717 718 } else { 719 this.$el.find('.col.elastic-portfolio-item[class*="tall"] img, .col.elastic-portfolio-item.wide img, .col.elastic-portfolio-item.regular img').addClass('auto-height'); 720 } 721 722 } // bypass cropping option 723 724 // non masonry 725 if(this.$el.hasClass('no-masonry') && this.$el.find('.col:first:visible').length > 0 && this.$el.parents('.wpb_gallery').length === 0){ 726 727 // skip style 9 728 if( !this.$el.is('[data-ps="9"]') && !this.$el.is('[data-bypass-cropping="true"]') ) { 729 730 // reset height for calcs 731 this.$el.find('.col img').css('height','auto'); 732 var tallColHeight = this.$el.find('.col:first:visible img').height(); 733 this.$el.find('.col img:not(.custom-thumbnail)').css('height',tallColHeight); 734 this.$el.find('.col .parallaxImg').css('height',tallColHeight); 735 } 736 737 } 738 739 }; 740 741 SalientPortfolio.prototype.reLayout = function() { 742 743 this.beforeReLayout(); 744 setTimeout(() => { 745 if (typeof this.$el.isotope === 'function') { 746 this.$el.isotope('layout'); 747 } 748 }, 500); 749 }; 750 751 752 753 SalientPortfolio.prototype.updatePrettyPhotoGallery = function(){ 754 755 756 if(this.$el.find('a[rel^="prettyPhoto"]').length > 0) { 757 758 var $unique_id = Math.floor(Math.random()*10000); 759 var $currentCat = this.$el.attr('data-current-cat'); 760 this.$el.find('.col'+$currentCat).find('a[rel^="prettyPhoto"]').attr('rel','prettyPhoto['+$unique_id+'_sorted]'); 761 762 } 763 764 765 }; 766 767 SalientPortfolio.prototype.updateMagPrettyPhotoGallery = function() { 768 769 770 var $currentCat = this.$el.attr('data-current-cat'); 771 var $unique_id = Math.floor(Math.random()*10000); 772 773 if(this.$el.is('[data-lightbox-only="true"]')){ 774 775 this.$el.find('.col').each(function(){ 776 777 $(this).find('a.gallery').removeClass('gallery').removeClass('magnific'); 778 779 if($(this).is($currentCat)) { 780 781 // parallax styles 782 if($(this).find('.parallaxImg-wrap').length > 0) { 783 784 if($('body[data-ls="fancybox"]').length > 0) { 785 $(this).find('.work-item > a:not([target="_blank"])').attr('data-fancybox','group_'+$unique_id); 786 } else { 787 $(this).find('.work-item > a:not([target="_blank"])').addClass('gallery').addClass('magnific'); 788 } 789 790 } else { 791 // others 792 793 if($('body[data-ls="fancybox"]').length > 0) { 794 $(this).find('.work-item a:not([target="_blank"])').attr('data-fancybox','group_'+$unique_id); 795 } else { 796 $(this).find('.work-item a:not([target="_blank"])').addClass('gallery').addClass('magnific'); 797 } 798 799 } 800 801 } 802 803 }); 804 805 } 806 807 else if (this.$el.find('.work-item.style-1').length > 0){ 808 809 this.$el.find('.col').each(function(){ 810 811 $(this).find('a.gallery').removeClass('gallery').removeClass('magnific'); 812 813 if($(this).is($currentCat)) { 814 815 if($('body[data-ls="fancybox"]').length > 0) { 816 $(this).find('.work-info .vert-center a:first-of-type').attr('data-fancybox','group_'+$unique_id); 817 } 818 else { 819 $(this).find('.work-info .vert-center a:first-of-type').addClass('gallery').addClass('magnific'); 820 } 821 822 } 823 824 }); 825 } 826 827 828 }; 829 830 831 832 SalientPortfolio.prototype.portfolioAccentColor = function() { 833 834 835 this.$el.find('.col').each(function(){ 836 if ($(this).has('[data-project-color]')) { 837 $(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color')); 838 839 // style5 840 $(this).find('.parallaxImg-rendered-layer .bg-overlay').css('border-color',$(this).attr('data-project-color')); 841 842 } 843 }); 844 845 }; 846 847 848 849 SalientPortfolio.prototype.isotopeCatSelection = function() { 850 851 var isotopeCatArr = []; 852 var $portfolioCatCount = 0; 853 this.$el.parent().parent().find('div[class^=portfolio-filters] ul li').each(function(i){ 854 if($(this).find('a').length > 0) { 855 isotopeCatArr[$portfolioCatCount] = $(this).find('a').attr('data-filter').substring(1); 856 $portfolioCatCount++; 857 } 858 }); 859 860 861 // ice the first (all) 862 isotopeCatArr.shift(); 863 864 865 var allItemCats = ''; 866 var self = this; 867 868 this.$el.find('> div').each(function(){ 869 allItemCats += $(this).attr('data-project-cat'); 870 }); 871 allItemCats = allItemCats.split(' '); 872 873 // remove the extra item on the end of blank space 874 allItemCats.pop(); 875 876 // make sure the array has no duplicates 877 var itemCats = [];
878 $.each(allItemCats, function(i, el){ 879 if($.inArray(el, itemCats) === -1) { 880 itemCats.push(el); 881 } 882 }); 883 884 885 886 // if user has chosen a set of filters to display - only show those 887 var $userSelectedCats; 888 889 if(this.$el.is('[data-categories-to-show]') && 890 this.$el.attr('data-categories-to-show').length != 0 && 891 this.$el.attr('data-categories-to-show') != 'all') { 892 893 $userSelectedCats = this.$el.attr('data-categories-to-show').replace(/,/g , ' '); 894 $userSelectedCats = $userSelectedCats.split(' '); 895 896 if(!this.$el.hasClass('infinite_scroll')) { 897 this.$el.removeAttr('data-categories-to-show'); 898 } 899 900 } else { 901 $userSelectedCats = itemCats; 902 } 903 904 905 // Find which categories are actually on the current page 906 var notFoundCats = []; 907 jQuery.grep(isotopeCatArr, function(el) { 908 909 if (jQuery.inArray(el, itemCats) == -1) notFoundCats.push(el); 910 if (jQuery.inArray(el, $userSelectedCats) == -1) notFoundCats.push(el); 911 912 }); 913 914 // manipulate the list 915 if(notFoundCats.length != 0){ 916 917 this.$el.parent().parent().find('div[class^=portfolio-filters] ul li').each(function(){ 918 if($(this).find('a').length > 0) { 919 if( jQuery.inArray($(this).find('a').attr('data-filter').substring(1), notFoundCats) != -1 ){ 920 921 if($(this).find('> ul.children').length > 0) { 922 $(this).find('> a').hide(); 923 } else { 924 $(this).hide(); 925 } 926 927 } else { 928 $(this).show(); 929 } 930 } 931 }); 932 933 } 934 935 936 }; 937 938 939 940 941 942 // portfolio single comment order 943 SalientPortfolio.prototype.portfolioCommentOrder = function(){ 944 945 if($('body').hasClass('mobile') && $('body').hasClass('single-portfolio') && $('#respond').length > 0){ 946 $('#sidebar').insertBefore('.comments-section'); 947 } 948 949 else if($('body').hasClass('single-portfolio') && $('#respond').length > 0) { 950 $('#sidebar').insertAfter('.post-area'); 951 } 952 953 }; 954 955 956 957 958 959 /*-------------------------------------------------------------------------*/ 960 /* 2. Salient Fullscreen Recent Project Slider 961 /*-------------------------------------------------------------------------*/ 962 963 function SalientRecentProjectsFullScreen(el) { 964 965 this.$el = el; 966 this.rotationSpeed = (el.attr('data-autorotate').length > 0) ? parseInt(el.attr('data-autorotate')) : false; 967 this.rotationInterval = null; 968 this.$window = $(window); 969 970 this.splitLineText(); 971 this.positionFix(); 972 this.sliderCalcs(); 973 this.sliderInit(); 974 this.resizeHandler(); 975 } 976 977 978 SalientRecentProjectsFullScreen.prototype.resizeHandler = function() { 979 $(window).resize(this.sliderCalcs.bind(this)); 980 $(window).resize(this.splitLineText.bind(this)); 981 }; 982 983 SalientRecentProjectsFullScreen.prototype.positionFix = function() { 984 985 // remove outside of column setups 986 987 if(this.$el.parents('.span_12').find('> .wpb_column').length > 1){ 988 var $zoomProjects = this.$el.clone(); 989 var $zoomProjectsRow = this.$el.parents('.span_12'); 990 this.$el.remove(); 991 $zoomProjectsRow.prepend($zoomProjects); 992 this.$el = $zoomProjects; 993 } 994 995 }; 996 997 998 SalientRecentProjectsFullScreen.prototype.sliderCalcs = function() { 999 1000 var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0; 1001 1002 // frontend editor fix 1003 var usingFrontEndEditor = (typeof window.vc_iframe === 'undefined') ? false : true; 1004 1005 if(usingFrontEndEditor) { 1006 if(this.$el.parents('.wpb_row').parent().index() > 1) { 1007 this.$el.parents('.first-section').removeClass('first-section'); 1008 } 1009 } 1010 1011 if(this.$el.parents('.first-section').length > 0) { 1012 this.$el.css('height',$(window).height() - this.$el.offset().top - $bodyBorderSize); 1013 } else { 1014 this.$el.css('height',$(window).height()); 1015 } 1016 1017 1018 }; 1019 1020 1021 1022 SalientRecentProjectsFullScreen.prototype.sliderRotate = function(){ 1023 1024 if($('body.vc_editor').length > 0) { return; } 1025 1026 var $controlSelector = (this.$el.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li'; 1027 var $controlSelectorInd = (this.$el.find('.project-slides').length > 0) ? 'span' : ' li'; 1028 1029 var $slideLength = this.$el.find($controlSelector).length; 1030 var $currentSlide = this.$el.find($controlSelector+'.active').index(); 1031 1032 if( $currentSlide+1 === $slideLength) { 1033 this.$el.find($controlSelector+':first-child').trigger('click'); 1034 } else { 1035 this.$el.find($controlSelector+'.active').next($controlSelectorInd).trigger('click'); 1036 } 1037 1038 }; 1039 1040 SalientRecentProjectsFullScreen.prototype.sliderResetRotate = function(){ 1041 clearInterval(this.rotationInterval); 1042 1043 // reinit autorotate 1044 if(this.rotationSpeed != 0) { 1045 var slide_interval = (this.rotationSpeed < 100) ? 4000 : this.rotationSpeed; 1046 this.rotationInterval = setInterval(this.sliderRotate.bind(this),slide_interval); 1047 } 1048 1049 }; 1050 1051 1052 SalientRecentProjectsFullScreen.prototype.splitLineText = function() { 1053 1054 1055 var $slideClass = (this.$el.find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide'; 1056 var $slideInfoClass = (this.$el.find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a'; 1057 1058 this.$el.find($slideClass).each(function(i){ 1059 1060 $(this).find($slideInfoClass).each(function(){ 1061 1062 var textArr = $(this).text(); 1063 textArr = textArr.trim(); 1064 textArr = textArr.split(' '); 1065 1066 $(this)[0].innerHTML = ''; 1067 1068 for(var i=0;i<textArr.length;i++) { 1069 $(this)[0].innerHTML += '<span>'+ textArr[i] + '</span> '; 1070 } 1071 1072 }); 1073 1074 $(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />'); 1075 1076 }); 1077 1078 1079 }; 1080 1081 1082 SalientRecentProjectsFullScreen.prototype.sliderInit = function() { 1083 1084 1085 var $projLength = this.$el.find('.project-slide').length; 1086 var self = this; 1087 1088 // autorotate 1089 if(this.rotationSpeed != 0) { 1090 var slide_interval = (this.rotationSpeed < 100) ? 4000 : this.rotationSpeed; 1091 this.rotationInterval = setInterval(this.sliderRotate.bind(this),slide_interval); 1092 } 1093 1094 // next/prev
1095 this.$el.find('.zoom-slider-controls .next').on('click',function(){ 1096 1097 // thres 1098 var $that = $(this); 1099 if(!$that.parent().hasClass('timeout')) { 1100 setTimeout(function(){ 1101 $that.parent().removeClass('timeout'); 1102 },1150); 1103 } 1104 1105 if($(this).parent().hasClass('timeout')) { 1106 return false; 1107 } 1108 1109 $(this).parent().addClass('timeout'); 1110 1111 // switch logic 1112 self.sliderResetRotate(); 1113 1114 var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current'); 1115 var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects'); 1116 1117 $sliderInstance.find('.project-slide').removeClass('next').removeClass('prev'); 1118 $sliderInstance.find('.project-slide').each(function(i){ 1119 1120 if(i < $current.index()+1 && $current.index()+1 < $projLength) { 1121 $(this).addClass('prev'); 1122 } 1123 else { 1124 $(this).addClass('next'); 1125 } 1126 1127 }); 1128 1129 if($current.index()+1 === $projLength) { 1130 $sliderInstance.find('.project-slide:first-child').addClass('no-trans'); 1131 } 1132 1133 setTimeout(function(){ 1134 1135 if($current.index()+1 === $projLength) { 1136 $sliderInstance.find('.project-slide:first-child') 1137 .removeClass('no-trans') 1138 .removeClass('next') 1139 .removeClass('prev') 1140 .addClass('current'); 1141 $sliderInstance.find('.project-slide:last-child') 1142 .removeClass('next') 1143 .removeClass('current') 1144 .addClass('prev'); 1145 } else { 1146 1147 $current 1148 .next('.project-slide') 1149 .removeClass('next') 1150 .removeClass('prev') 1151 .addClass('current'); 1152 $current 1153 .removeClass('current') 1154 .addClass('prev'); 1155 } 1156 1157 // update dot nav 1158 if($sliderInstance.find('.dot-nav').length > 0) { 1159 $sliderInstance.find('.dot-nav span.active').removeClass('active'); 1160 $sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active'); 1161 } 1162 1163 },30); 1164 1165 return false; 1166 1167 }); 1168 1169 this.$el.find('.zoom-slider-controls .prev').on('click',function(){ 1170 1171 // thres 1172 var $that = $(this); 1173 if(!$that.parent().hasClass('timeout')) { 1174 setTimeout(function(){ 1175 $that.parent().removeClass('timeout'); 1176 },1150); 1177 } 1178 1179 if($(this).parent().hasClass('timeout')) { 1180 return false; 1181 } 1182 1183 $(this).parent().addClass('timeout'); 1184 1185 self.sliderResetRotate(); 1186 1187 // switch logic 1188 var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current'); 1189 var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects'); 1190 1191 1192 $sliderInstance.find('.project-slide').removeClass('next').removeClass('prev'); 1193 $sliderInstance.find('.project-slide').each(function(i){ 1194 1195 if(i < $current.index() || $current.index() == 0) { 1196 $(this).addClass('prev'); 1197 } 1198 else { 1199 $(this).addClass('next'); 1200 } 1201 }); 1202 1203 if($current.index() == 0) { 1204 $sliderInstance.find('.project-slide:last-child').addClass('no-trans'); 1205 } 1206 1207 setTimeout(function(){ 1208 1209 if($current.index() == 0) { 1210 1211 $sliderInstance.find('.project-slide:last-child') 1212 .removeClass('no-trans') 1213 .removeClass('next') 1214 .removeClass('prev') 1215 .addClass('current'); 1216 $sliderInstance.find('.project-slide:first-child') 1217 .removeClass('next') 1218 .removeClass('prev') 1219 .removeClass('current') 1220 .addClass('next'); 1221 1222 } else { 1223 $current.prev('.project-slide').removeClass('next').removeClass('prev').addClass('current'); 1224 $current.removeClass('current').addClass('next'); 1225 } 1226 1227 //update dot nav 1228 if($sliderInstance.find('.dot-nav').length > 0) { 1229 $sliderInstance.find('.dot-nav span.active').removeClass('active'); 1230 $sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active'); 1231 } 1232 1233 },30); 1234 1235 1236 return false;
1237 1238 }); 1239 1240 // pagination 1241 this.$el.find('> .normal-container > .dot-nav').remove(); 1242 this.$el.find('> .normal-container').append('<div class="dot-nav"></div>'); 1243 for(var $i=0;$i < $projLength;$i++) { 1244 if($i == 0) { 1245 this.$el.find('.dot-nav').append('<span class="dot active"><span></span></span>'); 1246 } else { 1247 this.$el.find('.dot-nav').append('<span class="dot"><span></span></span>'); 1248 } 1249 1250 } 1251 1252 1253 var $dotIndex = 1; 1254 1255 this.$el.find('.dot-nav > span').on('click',function(){ 1256 1257 if($(this).hasClass('active')) { 1258 return; 1259 } 1260 1261 // thres 1262 var $that = $(this); 1263 if(!$that.parent().hasClass('timeout')) { 1264 setTimeout(function(){ 1265 $that.parent().removeClass('timeout'); 1266 },1150); 1267 } 1268 1269 if($(this).parent().hasClass('timeout')) { 1270 return; 1271 } 1272 1273 $(this).parent().addClass('timeout'); 1274 1275 self.sliderResetRotate(); 1276 1277 // switch logic 1278 $(this).parent().find('span.active').removeClass('active'); 1279 $(this).addClass('active'); 1280 1281 $dotIndex = $(this).index() + 1; 1282 1283 var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current'); 1284 var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects'); 1285 1286 var $prevIndex = $current.index() + 1; 1287 1288 $sliderInstance.find('.project-slide').removeClass('next').removeClass('prev'); 1289 1290 $sliderInstance.find('.project-slide').each(function(i){ 1291 if(i < $dotIndex-1) { 1292 $(this).addClass('prev'); 1293 } 1294 else { 1295 $(this).addClass('next'); 1296 } 1297 }); 1298 1299 // going prev 1300 if($prevIndex > $dotIndex) { 1301 1302 $sliderInstance.find('.project-slide') 1303 .eq($dotIndex-1) 1304 .addClass('no-trans') 1305 .addClass('prev') 1306 .removeClass('next'); 1307 1308 setTimeout(function(){ 1309 1310 $sliderInstance.find('.project-slide') 1311 .eq($dotIndex-1) 1312 .removeClass('no-trans') 1313 .removeClass('next') 1314 .removeClass('prev') 1315 .addClass('current'); 1316 1317 $current 1318 .removeClass('current') 1319 .addClass('next'); 1320 1321 },30); 1322 1323 } 1324 1325 // going forawrd 1326 else { 1327 $sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('next').removeClass('prev'); 1328 setTimeout(function(){ 1329 $sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current'); 1330 $current.removeClass('current').addClass('prev'); 1331 },30); 1332 1333 } 1334 1335 }); 1336 1337 1338 }; 1339 1340 1341 1342 /*-------------------------------------------------------------------------*/ 1343 /* 3. Salient Recent Project Carousel 1344 /*-------------------------------------------------------------------------*/ 1345 1346 function SalientRecentProjectsCarousel(el) { 1347 1348 this.$el = el; 1349 1350 this.carouselInit(); 1351 this.resizeHandler(); 1352 1353 } 1354 1355 1356 SalientRecentProjectsCarousel.prototype.resizeHandler = function() { 1357 $(window).resize(this.carouselHeightCalcs.bind(this)); 1358 }; 1359 1360 SalientRecentProjectsCarousel.prototype.carouselInit = function() { 1361 1362 var $that = this.$el; 1363 var self = this; 1364 var maxCols = (this.$el.parents('.carousel-wrap').attr('data-full-width') === 'true') ? 'auto' : 3 ; 1365 var scrollNum = (this.$el.parents('.carousel-wrap').attr('data-full-width') === 'true') ? 'auto' : '' ; 1366 var colWidth = (this.$el.parents('.carousel-wrap').attr('data-full-width') === 'true') ? 500 : 453 ; 1367 var scrollSpeed, easing; 1368 var $autoplayBool = (this.$el.attr('data-autorotate') === 'true') ? true : false; 1369 var $themeSkin, $themeSkin2; 1370 1371 if($('body.ascend').length > 0 && this.$el.parents('.carousel-wrap').attr('data-full-width') !== 'true' || 1372 $('body.material').length > 0 && this.$el.parents('.carousel-wrap').attr('data-full-width') !== 'true') { 1373 1374 if(this.$el.find('li').length % 3 === 0) { 1375 $themeSkin = true; 1376 $themeSkin2 = true; 1377 } else { 1378 $themeSkin = false; 1379 $themeSkin2 = true; 1380 } 1381 1382 } else { 1383 $themeSkin = true; 1384 $themeSkin2 = true; 1385 } 1386 1387 (parseInt(this.$el.attr('data-scroll-speed'))) ? scrollSpeed = parseInt(this.$el.attr('data-scroll-speed')) : scrollSpeed = 700; 1388 (this.$el.is('[data-easing]')) ? easing = this.$el.attr('data-easing') : easing = 'linear'; 1389 1390 // Handle coloring. 1391 this.$el.find('.col').each(function() { 1392 if ($(this).has('[data-project-color]')) { 1393 $(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color')); 1394 } 1395 }); 1396 1397 var $element = $that; 1398 if($that.find('img').length === 0) { 1399 $element = $('body'); 1400 } 1401 1402 imagesLoaded($element,function(){ 1403 1404 $that.carouFredSel({ 1405 circular: $themeSkin, 1406 infinite: $themeSkin2, 1407 height : 'auto', 1408 responsive: true, 1409 items : { 1410 width : colWidth, 1411 visible : { 1412 min : 1, 1413 max : maxCols 1414 } 1415 }, 1416 swipe : { 1417 onTouch : true, 1418 onMouse : true, 1419 options : { 1420 excludedElements: "button, input, select, textarea, .noSwipe", 1421 tap: function(event, target){ 1422 if($(target).attr('href') && 1423 !$(target).is('[target="_blank"]') && 1424 !$(target).is('[data-fancybox^="group_"]') && 1425 !$(target).is('[rel^="prettyPhoto"]') && 1426 !$(target).is('.magnific-popup') && 1427 !$(target).is('.magnific')) { 1428 window.open($(target).attr('href'), '_self'); 1429 } 1430 } 1431 }, 1432 onBefore : function(){ 1433 // hover effect fix 1434 $that.find('.work-item').trigger('mouseleave'); 1435 $that.find('.work-item .work-info a').trigger('mouseup'); 1436 } 1437 }, 1438 scroll: { 1439 items : scrollNum, 1440 easing : easing, 1441 duration : scrollSpeed, 1442 onBefore : function( data ) { 1443 1444 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1445 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1446 $that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1447 1448 } 1449 }, 1450 onAfter : function( data ) { 1451 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1452 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1453 $that.parents('.carousel-wrap').find('.item-count .current').html( $that.triggerHandler('currentPage') +1); 1454 $that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); 1455 1456 } 1457 } 1458 1459 }, 1460 prev : { 1461 button : function() { 1462 return $that.parents('.carousel-wrap').find('.carousel-prev'); 1463 } 1464 }, 1465 next : { 1466 button : function() { 1467 return $that.parents('.carousel-wrap').find('.carousel-next'); 1468 } 1469 }, 1470 auto : { 1471 play: $autoplayBool 1472 } 1473 }, { transition: true }).animate({'opacity': 1},1300); 1474 1475 $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">'); 1476 1477 if($that.parents('.carousel-wrap').attr('data-full-width') === 'true') { 1478 $that.parents('.carousel-outer').css('overflow','visible'); 1479 } 1480 1481 // add count for non full width ascend skin 1482 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1483 $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1484 $('<div class="item-count"><span class="current">1</span>/<span class="total">'+($that.find('> li').length / $that.triggerHandler("currentVisible").length) +'</span></div>').insertAfter($that.parents('.carousel-wrap').find('.carousel-prev')); 1485 } 1486 1487 $that.addClass('finished-loading'); 1488 1489 self.carouselHeightCalcs(); 1490 1491 });//images loaded 1492 1493 1494 1495 1496 }; 1497 1498 1499 1500 SalientRecentProjectsCarousel.prototype.carouselHeightCalcs = function(){ 1501 1502 if( !this.$el.hasClass('finished-loading') ) { 1503 return; 1504 } 1505 1506 var that = this; 1507 var bottomSpace = (this.$el.parents('.carousel-wrap').attr('data-full-width') === 'true' && this.$el.find('.style-2, .style-3, .style-4').length > 0) ? 0 : 28 ; 1508 var tallestMeta = 0; 1509 1510 this.$el.find('> li').each(function(){ 1511 ($(this).find('.work-meta').height() > tallestMeta) ? tallestMeta = $(this).find('.work-meta').height() : tallestMeta = tallestMeta; 1512 }); 1513 1514 setTimeout(function(){ 1515 that.$el.parents('.caroufredsel_wrapper').css({ 1516 'height' : (that.$el.find('.work-item').outerHeight() + tallestMeta + bottomSpace -2) + 'px' 1517 }); 1518 },30); 1519 1520 1521 if($('body.ascend').length > 0 && this.$el.parents('.carousel-wrap').attr('data-full-width') != 'true' || 1522 $('body.material').length > 0 && this.$el.parents('.carousel-wrap').attr('data-full-width') != 'true') { 1523 this.$el.parents('.carousel-wrap').find('.item-count .current').html(Math.ceil((this.$el.triggerHandler("currentPosition")+1)/this.$el.triggerHandler("currentVisible").length)); 1524 this.$el.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil(this.$el.find('> li').length / this.$el.triggerHandler("currentVisible").length)); 1525 } 1526 1527 1528 }; 1529 1530 1531 window.SalientPortfolio = SalientPortfolio; 1532 window.SalientRecentProjectsFullScreen = SalientRecentProjectsFullScreen; 1533 window.SalientRecentProjectsCarousel = SalientRecentProjectsCarousel; 1534 1535 1536}( jQuery )); 1537 1538 1539 1540/* 1541* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 1542*/ 1543jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c},easeOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e/2)==2)return c+d;if(!g)g=e*.3*1.5;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);if(b<1)return-.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c;return h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)*.5+d+c},easeInBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;if((b/=e/2)<1)return d/2*b*b*(((f*=1.525)+1)*b-f)+c;return d/2*((b-=2)*b*(((f*=1.525)+1)*b+f)+2)+c},easeInBounce:function(a,b,c,d,e){return d-jQuery.easing.easeOutBounce(a,e-b,0,d,e)+c}
1543,easeOutBounce:function(a,b,c,d,e){if((b/=e)<1/2.75){return d*7.5625*b*b+c}else if(b<2/2.75){return d*(7.5625*(b-=1.5/2.75)*b+.75)+c}else if(b<2.5/2.75){return d*(7.5625*(b-=2.25/2.75)*b+.9375)+c}else{return d*(7.5625*(b-=2.625/2.75)*b+.984375)+c}},easeInOutBounce:function(a,b,c,d,e){if(b<e/2)return jQuery.easing.easeInBounce(a,b*2,0,d,e)*.5+c;return jQuery.easing.easeOutBounce(a,b*2-e,0,d,e)*.5+d*.5+c}}) 1544 1545 1546//visible 1547!function(t){var i=t(window);t.fn.visible=function(t,e,o){if(!(this.length<1)){var r=this.length>1?this.eq(0):this,n=r.get(0),f=i.width(),h=i.height(),o=o?o:"both",l=e===!0?n.offsetWidth*n.offsetHeight:!0;if("function"==typeof n.getBoundingClientRect){var g=n.getBoundingClientRect(),u=g.top>=0&&g.top<h,s=g.bottom>0&&g.bottom<=h,c=g.left>=0&&g.left<f,a=g.right>0&&g.right<=f,v=t?u||s:u&&s,b=t?c||a:c&&a;if("both"===o)return l&&v&&b;if("vertical"===o)return l&&v;if("horizontal"===o)return l&&b}else{var d=i.scrollTop(),p=d+h,w=i.scrollLeft(),m=w+f,y=r.offset(),z=y.top,B=z+r.height(),C=y.left,R=C+r.width(),j=t===!0?B:z,q=t===!0?z:B,H=t===!0?R:C,L=t===!0?C:R;if("both"===o)return!!l&&p>=q&&j>=d&&m>=L&&H>=w;if("vertical"===o)return!!l&&p>=q&&j>=d;if("horizontal"===o)return!!l&&m>=L&&H>=w}}}}(jQuery); 1548 1549 1550 1551 1552jQuery(document).ready(function($) { 1553 1554 "use strict"; 1555 1556 // when not using Salient, get things rollin' 1557 if( nectar_theme_info.using_salient != 'true' ) { 1558 1559 // portfolio el. 1560 var portfolioArr = []; 1561 1562 $('.portfolio-items:not(.carousel)').each(function(i){ 1563 1564 $(this).attr('instance',i); 1565 $(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance',i); 1566 1567 portfolioArr[i] = new SalientPortfolio($(this)); 1568 }); 1569 1570 // fullscreen project slider. 1571 1572 var fsProjectSliderArr = []; 1573 1574 $('.nectar_fullscreen_zoom_recent_projects').each(function(i){ 1575 fsProjectSliderArr[i] = new SalientRecentProjectsFullScreen($(this)); 1576 }); 1577 1578 1579 // project carousel. 1580 var projectCarouselArr = []; 1581 $('ul.portfolio-items.carousel').each(function(i){ 1582 projectCarouselArr[i] = new SalientRecentProjectsCarousel($(this)); 1583 }); 1584 1585 } 1586 1587});
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.