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