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