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