(function($){ "use strict"; function SalientPortfolio(el, fullWidthContentColumns){ this.$el=el; this.fullWidthContentColumns=fullWidthContentColumns; this.$window=$(window); this.onMobile=false; this.clearIsoAnimation=null; this.mediaQuerySize=''; this.mouseEventHandler(); this.portfolioFiltersInit(); this.masonryInit(); this.resizeHandler(); if(this.$el.find('.inner-wrap[data-animation="perspective"]').length > 0){ this.perspectiveAnimationInit(); } this.portfolioAccentColor(); this.isotopeCatSelection(); this.portfolioCommentOrder(); } SalientPortfolio.prototype.masonryInit=function(){ var instance=this; this.$el.imagesLoaded(function(){ var $layoutMode=(instance.$el.hasClass('masonry-items')) ? 'packery':'fitRows'; var $startingFilter=(instance.$el.attr('data-starting-filter')!=''&&instance.$el.attr('data-starting-filter')!='default') ? '.' + instance.$el.attr('data-starting-filter'):'*'; instance.reLayout(); instance.$el.addClass('isotope-activated'); instance.$el.isotope({ itemSelector:'.element', filter: $startingFilter, layoutMode: $layoutMode, transitionDuration: '0.6s', packery: { gutter: 0 }}).isotope('layout'); if($startingFilter!='*'){ if(instance.$el.parent().parent().find('.portfolio-filters').length > 0){ instance.$el.parent().parent().find('.portfolio-filters ul a[data-filter="'+$startingFilter+'"]').trigger('click'); }else{ instance.$el.parent().parent().find('.portfolio-filters-inline ul a[data-filter="'+$startingFilter+'"]').trigger('click'); }}else{ if(instance.$el.parent().parent().find('.portfolio-filters-inline[data-alignment="left"]').length > 0 || instance.$el.parent().parent().find('.portfolio-filters-inline[data-alignment="center"]').length > 0){ instance.$el.parent().parent().find('.portfolio-filters-inline .container > ul > li:nth-child(1) a').trigger('click').addClass('active'); }else{ instance.$el.parent().parent().find('.portfolio-filters-inline .container > ul > li:nth-child(2) a').trigger('click').addClass('active'); }} instance.loadAnimationWaypoint(); instance.masonryZindex(); var self=this; setTimeout(function(){ instance.masonryZindex(); },800); if(instance.$el.parents('.full-width-content').length > 0){ setTimeout(function(){ instance.fullWidthContentColumns(); },200); } $('.portfolio-loading').stop(true,true).fadeOut(200); if(instance.$el.find('.inner-wrap').attr('data-animation')==='none'){ instance.$el.find('.inner-wrap').removeClass('animated'); }}); $(".portfolio-items").find("a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); $(".recent_projects_widget").find("a[href*='http://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); $(".portfolio-items").find("a[href*='https://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); $(".recent_projects_widget").find("a[href*='https://']:not([href*='" + window.location.hostname + "'])").attr("target", "_blank"); }; SalientPortfolio.prototype.resizeHandler=function(){ var self=this; this.$window.resize(function(){ setTimeout(function(){ self.reLayout(); self.masonryZindex(); self.portfolioCommentOrder(); },30); }); }; SalientPortfolio.prototype.mouseEventHandler=function(){ if(this.$el.parent().parent().find('.portfolio-filters').length > 0){ this.$el.parent().parent().find('.portfolio-filters ul li a').on('click', this.isoClickFilter.bind(this)); }else{ this.$el.parent().parent().find('.portfolio-filters-inline ul li a').on('click', this.isoClickFilter.bind(this)); } $('body').on('mouseenter','.portfolio-filters',function(){ if(!this.onMobile){ $(this).find('> ul').stop(true,true).slideDown(500,'easeOutExpo'); } $(this).find('a#sort-portfolio span').html($(this).find('a#sort-portfolio').attr('data-sortable-label')); }); $('body').on('mouseleave','.portfolio-filters',function(){ var $activeCat=$(this).find('a.active').html(); if(typeof $activeCat=='undefined'||$activeCat.length==0){ $activeCat=$(this).attr('data-sortable-label'); } $(this).find('a#sort-portfolio span').html($activeCat); if(!this.onMobile){ $(this).find('> ul').stop(true,true).slideUp(500,'easeOutExpo'); }}); $('body').on('click','.portfolio-filters ul li a', function(){ $(this).parents('.portfolio-filters').find('#sort-portfolio span').html($(this).html()); }); $('body').on('click','.portfolio-filters > a#sort-portfolio', function(){ return false; }); var $tmpTitle=null; $('.portfolio-items > .col a[title]').on('mouseenter', function (){ $tmpTitle=$(this).attr('title'); $(this).attr('title', ''); }); $('.portfolio-items > .col a[title]').on('mouseleave', function (){ $(this).attr('title', $tmpTitle); }); $('.portfolio-items > .col a[title]').on('click', function (){ $(this).attr('title', $tmpTitle); }); }; SalientPortfolio.prototype.portfolioFiltersInit=function(){ if($('body').hasClass('mobile')||navigator.userAgent.match(/(iPad|IEMobile)/)){ this.onMobile=true; $('body').off('mouseenter mouseleave', '.portfolio-filters'); this.$el.parent().parent().find('.portfolio-filters > a, .portfolio-filters ul li a').on('click',function(e){ if(e.originalEvent!==undefined){ $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic'); }}); } $('body.single-portfolio #header-outer nav > ul > li > a:contains("Portfolio")').parents('li').addClass('current-menu-item'); }; SalientPortfolio.prototype.isoClickFilter=function(e){ var $timeout; var self=this; if(window.innerWidth > 690&&!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ clearTimeout($timeout); $timeout=setTimeout(function(){ self.masonryZindex(); },600); } var selector=$(e.target).attr('data-filter'); this.$el.isotope({ filter: selector }).attr('data-current-cat',selector); if(this.$el.find('.inner-wrap[data-animation="none"]').length===0){ this.$el.find('.col').addClass('animated-in'); } $(e.target).parent().parent().find('li a').removeClass('active'); $(e.target).addClass('active'); if($(e.target).parents('.portfolio-filters-inline').length > 0){ $(e.target).parents('.portfolio-filters-inline').find('#current-category').html($(e.target).html()); } if(this.$el.find('a[rel^="prettyPhoto"]').length > 0){ setTimeout(this.updatePrettyPhotoGallery.bind(this),170); }else{ setTimeout(this.updateMagPrettyPhotoGallery.bind(this),170); } return false; }; SalientPortfolio.prototype.loadAnimationWaypoint=function(){ var $portfolioOffsetPos=($('#nectar_fullscreen_rows').length > 0) ? '200%':'90%'; if(this.$el.find('.inner-wrap').attr('data-animation')==='none'){ return; } this.$el.find('.col').each(function(i){ var $that=$(this); if($(this).visible(true)||$(this).parents('#nectar_fullscreen_rows').length > 0){ var $portfolioAnimationDelay=($that.is('[data-masonry-type="photography"].masonry-items')) ? 90:115; $(this).delay($portfolioAnimationDelay *i).queue(function(next){ $(this).addClass("animated-in"); next(); }); }else{ var waypoint=new Waypoint({ element: $that, handler: function(){ if($that.parents('.wpb_tab').length > 0&&$that.parents('.wpb_tab').css('visibility')==='hidden'||$that.hasClass('animated-in')){ waypoint.destroy(); return; } var $portfolioAnimationDelay=($that.is('[data-masonry-type="photography"].masonry-items')) ? 85:100; setTimeout(function(){ $that.addClass("animated-in"); },$portfolioAnimationDelay * $that.attr('data-delay-amount')); waypoint.destroy(); }, offset: $portfolioOffsetPos }); }}); }; SalientPortfolio.prototype.perspectiveAnimationInit=function(){ var lastScrollTop=$(window).scrollTop(); var self=this; this.$el.css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px'); requestAnimationFrame(updatePerspectiveOrigin); function updatePerspectiveOrigin(){ var scrollTop=$(window).scrollTop(); if(lastScrollTop===scrollTop){ requestAnimationFrame(updatePerspectiveOrigin); return; }else{ lastScrollTop=scrollTop; self.$el.css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px'); requestAnimationFrame(updatePerspectiveOrigin); }} }; SalientPortfolio.prototype.portfolioItemWidths=function(){ var isFullWidth=this.$el.attr('data-col-num')==='elastic'; if(isFullWidth){ var $elWidth=this.$el.width(); var $colSize=4; var $mult=(this.mediaQuerySize==='one') ? 1:2; if(this.mediaQuerySize==='five'){ $colSize=5; } else if(this.mediaQuerySize==='four'){ $colSize=4; } else if(this.mediaQuerySize==='three'){ $colSize=3; } else if(this.mediaQuerySize==='two'){ $colSize=2; } else if(this.mediaQuerySize==='one'){ $colSize=1; } if(this.$el.is('[data-ps="6"]')&&$colSize==5){ $colSize=4; } if(isFullWidth&&this.$el.is('[data-masonry-type="photography"]')&&!this.$el.hasClass('no-masonry')){ if(this.mediaQuerySize==='five'){ $colSize=6; } if(this.mediaQuerySize==='four'){ $colSize=5; } if(this.mediaQuerySize==='three'){ $colSize=4; }} if($elWidth % $colSize===0){ this.$el.find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',Math.floor($elWidth/$colSize) +'px'); this.$el.find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',Math.floor($elWidth/$colSize*$mult) +'px'); }else{ var $loopEndNum=($(window).width() > 1000) ? 6:3; if(this.$el.hasClass('fullwidth-constrained')&&$(window).width() > 1000){ $loopEndNum=4; } for(var i=1; i<$loopEndNum; i++){ if(($elWidth - i) % $colSize===0){ this.$el.find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',($elWidth-i)/$colSize +'px'); this.$el.find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',($elWidth-i)/$colSize*$mult +'px'); }} }} }; SalientPortfolio.prototype.masonryZindex=function(){ if($('body .portfolio-items:not(".carousel") > .col').length > 0 && $('body .portfolio-items:not(".carousel") > .col').offset().left){ var self=this; $('body .portfolio-items:not(".carousel")').each(function(){ var $coords={}; var $zindexRelation={}; var $that=$(this); $(this).find('> .col').each(function(){ var $itemOffset=$(this).offset(); $itemOffset=$itemOffset.left; $coords[$(this).index()]=$itemOffset; $(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20))); }); var $corrdsArr=jQuery.map($coords, function (value){ return value; }); $corrdsArr=self.removeDuplicates($corrdsArr); $corrdsArr.sort(function(a,b){ return a-b; }); for(var i=0; i < $corrdsArr.length; i++){ $zindexRelation[$corrdsArr[i]]=i; } jQuery.each($coords,function(k,v){ var $zindex; var $coordCache=v; jQuery.each($zindexRelation,function(k,v){ if($coordCache===k){ $zindex=v; }}); $that.find('> .col:eq('+k+')').attr('data-delay-amount',$zindex); }); }); }}; SalientPortfolio.prototype.removeDuplicates=function(inputArray){ var i; var len=inputArray.length; var outputArray=[]; var temp={}; for (i=0; i < len; i++){ temp[inputArray[i]]=0; } for (i in temp){ outputArray.push(i); } return outputArray; }; SalientPortfolio.prototype.reLayout=function(){ var self=this; clearTimeout(this.clearIsoAnimation); this.$el.find('.col').addClass('no-transition'); this.clearIsoAnimation=setTimeout(function(){ self.$el.find('.col').removeClass('no-transition'); },700); if(window.innerWidth > 1600){ if(this.$el.hasClass('fullwidth-constrained')){ if(this.$el.is('[data-masonry-type="photography"]')){ this.mediaQuerySize='three'; }else{ this.mediaQuerySize='four'; }}else{ if(this.$el.hasClass('constrain-max-cols')){ this.mediaQuerySize='four'; }else{ this.mediaQuerySize='five'; }} }else if(window.innerWidth <=1600&&window.innerWidth > 1300){ if(this.$el.hasClass('fullwidth-constrained')){ if(this.$el.is('[data-masonry-type="photography"]')){ this.mediaQuerySize='three'; }else{ this.mediaQuerySize='four'; }}else{ this.mediaQuerySize='four'; }}else if(window.innerWidth <=1300&&window.innerWidth > 990){ if(this.$el.hasClass('constrain-max-cols')){ this.mediaQuerySize='four'; }else{ this.mediaQuerySize='three'; }}else if(window.innerWidth <=990&&window.innerWidth > 470){ this.mediaQuerySize='two'; }else if(window.innerWidth <=470){ this.mediaQuerySize='one'; } if($('#boxed').length > 0){ if(window.innerWidth > 1300){ this.mediaQuerySize='four'; }else if(window.innerWidth < 1300&&window.innerWidth > 990){ if(this.$el.hasClass('constrain-max-cols')){ this.mediaQuerySize='four'; }else{ this.mediaQuerySize='three'; }}else if(window.innerWidth < 990){ this.mediaQuerySize='one'; }} this.portfolioItemWidths(); if(!this.$el.is('[data-bypass-cropping="true"]')){ if(this.$el.find('.col.elastic-portfolio-item[class*="regular"]:visible').length > 0 || this.$el.find('.col.elastic-portfolio-item[class*="wide"]:visible').length > 0 || this.$el.find('.col.elastic-portfolio-item[class*="tall"]:visible').length > 0 || this.$el.find('.col.elastic-portfolio-item[class*="wide_tall"]:visible').length > 0){ 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; var multipler=(window.innerWidth > 470) ? 2:1; var $itemClassForSizing='regular'; if(this.$el.find('.col.elastic-portfolio-item[class*="regular"]:visible').length===0 && this.$el.find('.col.elastic-portfolio-item.wide:visible').length > 0){ $itemClassForSizing='wide'; }else if(this.$el.find('.col.elastic-portfolio-item[class*="regular"]:visible').length===0 && this.$el.find('.col.elastic-portfolio-item.wide_tall:visible').length > 0){ $itemClassForSizing='wide_tall'; multipler=1; }else if(this.$el.find('.col.elastic-portfolio-item[class*="regular"]:visible').length===0 && this.$el.find('.col.elastic-portfolio-item.tall:visible').length > 0){ $itemClassForSizing='tall'; multipler=1; } this.$el.find('.col.elastic-portfolio-item.'+$itemClassForSizing+' img').css('height','auto'); var tallColHeight=this.$el.find('.col.elastic-portfolio-item.'+$itemClassForSizing+':visible img').height(); 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'); this.$el.find('.col.elastic-portfolio-item[class*="tall"] img:not(.custom-thumbnail)').css('height',(tallColHeight*multipler) + ($gutterSize*2)); if($itemClassForSizing==='regular'||$itemClassForSizing==='wide'){ this.$el.find('.col.elastic-portfolio-item.wide img:not(.custom-thumbnail), .col.elastic-portfolio-item.regular img:not(.custom-thumbnail)').css('height',tallColHeight); }else{ 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)); } 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); if($itemClassForSizing==='regular'||$itemClassForSizing==='wide'){ this.$el.find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',tallColHeight); }else{ this.$el.find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',(tallColHeight/2) - ($gutterSize*2)); }}else{ 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'); }} if(this.$el.hasClass('no-masonry')&&this.$el.find('.col:first:visible').length > 0&&this.$el.parents('.wpb_gallery').length===0){ if(!this.$el.is('[data-ps="9"]')&&!this.$el.is('[data-bypass-cropping="true"]')){ this.$el.find('.col img').css('height','auto'); var tallColHeight=this.$el.find('.col:first:visible img').height(); this.$el.find('.col img:not(.custom-thumbnail)').css('height',tallColHeight); this.$el.find('.col .parallaxImg').css('height',tallColHeight); }} if(this.$el.isotope()){ this.$el.isotope('layout'); }}; SalientPortfolio.prototype.updatePrettyPhotoGallery=function(){ if(this.$el.find('a[rel^="prettyPhoto"]').length > 0){ var $unique_id=Math.floor(Math.random()*10000); var $currentCat=this.$el.attr('data-current-cat'); this.$el.find('.col'+$currentCat).find('a[rel^="prettyPhoto"]').attr('rel','prettyPhoto['+$unique_id+'_sorted]'); }}; SalientPortfolio.prototype.updateMagPrettyPhotoGallery=function(){ var $currentCat=this.$el.attr('data-current-cat'); var $unique_id=Math.floor(Math.random()*10000); if(this.$el.is('[data-lightbox-only="true"]')){ this.$el.find('.col').each(function(){ $(this).find('a.gallery').removeClass('gallery').removeClass('magnific'); if($(this).is($currentCat)){ if($(this).find('.parallaxImg-wrap').length > 0){ if($('body[data-ls="fancybox"]').length > 0){ $(this).find('.work-item > a').attr('data-fancybox','group_'+$unique_id); }else{ $(this).find('.work-item > a').addClass('gallery').addClass('magnific'); }}else{ if($('body[data-ls="fancybox"]').length > 0){ $(this).find('.work-item a').attr('data-fancybox','group_'+$unique_id); }else{ $(this).find('.work-info a').addClass('gallery').addClass('magnific'); }} }}); } else if(this.$el.find('.work-item.style-1').length > 0){ this.$el.find('.col').each(function(){ $(this).find('a.gallery').removeClass('gallery').removeClass('magnific'); if($(this).is($currentCat)){ if($('body[data-ls="fancybox"]').length > 0){ $(this).find('.work-info .vert-center a:first-of-type').attr('data-fancybox','group_'+$unique_id); }else{ $(this).find('.work-info .vert-center a:first-of-type').addClass('gallery').addClass('magnific'); }} }); }}; SalientPortfolio.prototype.portfolioAccentColor=function(){ this.$el.find('.col').each(function(){ if($(this).has('[data-project-color]')){ $(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color')); $(this).find('.parallaxImg-rendered-layer .bg-overlay').css('border-color',$(this).attr('data-project-color')); }}); }; SalientPortfolio.prototype.isotopeCatSelection=function(){ var isotopeCatArr=[]; var $portfolioCatCount=0; this.$el.parent().parent().find('div[class^=portfolio-filters] ul li').each(function(i){ if($(this).find('a').length > 0){ isotopeCatArr[$portfolioCatCount]=$(this).find('a').attr('data-filter').substring(1); $portfolioCatCount++; }}); isotopeCatArr.shift(); var itemCats=''; var self=this; this.$el.find('> div').each(function(){ itemCats +=$(this).attr('data-project-cat'); }); itemCats=itemCats.split(' '); itemCats.pop(); itemCats=jQuery.unique(itemCats); var $userSelectedCats; if(this.$el.is('[data-categories-to-show]') && this.$el.attr('data-categories-to-show').length!=0 && this.$el.attr('data-categories-to-show')!='all'){ $userSelectedCats=this.$el.attr('data-categories-to-show').replace(/,/g , ' '); $userSelectedCats=$userSelectedCats.split(' '); if(!this.$el.hasClass('infinite_scroll')){ this.$el.removeAttr('data-categories-to-show'); }}else{ $userSelectedCats=itemCats; } var notFoundCats=[]; jQuery.grep(isotopeCatArr, function(el){ if(jQuery.inArray(el, itemCats)==-1) notFoundCats.push(el); if(jQuery.inArray(el, $userSelectedCats)==-1) notFoundCats.push(el); }); if(notFoundCats.length!=0){ this.$el.parent().parent().find('div[class^=portfolio-filters] ul li').each(function(){ if($(this).find('a').length > 0){ if(jQuery.inArray($(this).find('a').attr('data-filter').substring(1), notFoundCats)!=-1){ if($(this).find('> ul.children').length > 0){ $(this).find('> a').hide(); }else{ $(this).hide(); }}else{ $(this).show(); }} }); }}; SalientPortfolio.prototype.portfolioCommentOrder=function(){ if($('body').hasClass('mobile')&&$('body').hasClass('single-portfolio')&&$('#respond').length > 0){ $('#sidebar').insertBefore('.comments-section'); } else if($('body').hasClass('single-portfolio')&&$('#respond').length > 0){ $('#sidebar').insertAfter('.post-area'); }}; function SalientRecentProjectsFullScreen(el){ this.$el=el; this.rotationSpeed=(el.attr('data-autorotate').length > 0) ? parseInt(el.attr('data-autorotate')):false; this.rotationInterval=null; this.$window=$(window); this.splitLineText(); this.positionFix(); this.sliderCalcs(); this.sliderInit(); this.resizeHandler(); } SalientRecentProjectsFullScreen.prototype.resizeHandler=function(){ $(window).resize(this.sliderCalcs.bind(this)); $(window).resize(this.splitLineText.bind(this)); }; SalientRecentProjectsFullScreen.prototype.positionFix=function(){ if(this.$el.parents('.span_12').find('> .wpb_column').length > 1){ var $zoomProjects=this.$el.clone(); var $zoomProjectsRow=this.$el.parents('.span_12'); this.$el.remove(); $zoomProjectsRow.prepend($zoomProjects); this.$el=$zoomProjects; }}; SalientRecentProjectsFullScreen.prototype.sliderCalcs=function(){ var $bodyBorderSize=($('.body-border-top').length > 0&&$(window).width() > 1000) ? $('.body-border-top').height(): 0; var usingFrontEndEditor=(typeof window.vc_iframe==='undefined') ? false:true; if(usingFrontEndEditor){ if(this.$el.parents('.wpb_row').parent().index() > 1){ this.$el.parents('.first-section').removeClass('first-section'); }} if(this.$el.parents('.first-section').length > 0){ this.$el.css('height',$(window).height() - this.$el.offset().top - $bodyBorderSize); }else{ this.$el.css('height',$(window).height()); }}; SalientRecentProjectsFullScreen.prototype.sliderRotate=function(){ if($('body.vc_editor').length > 0){ return; } var $controlSelector=(this.$el.find('.project-slides').length > 0) ? '.dot-nav > span':'.controls > li'; var $controlSelectorInd=(this.$el.find('.project-slides').length > 0) ? 'span':' li'; var $slideLength=this.$el.find($controlSelector).length; var $currentSlide=this.$el.find($controlSelector+'.active').index(); if($currentSlide+1===$slideLength){ this.$el.find($controlSelector+':first-child').trigger('click'); }else{ this.$el.find($controlSelector+'.active').next($controlSelectorInd).trigger('click'); }}; SalientRecentProjectsFullScreen.prototype.sliderResetRotate=function(){ clearInterval(this.rotationInterval); if(this.rotationSpeed!=0){ var slide_interval=(this.rotationSpeed < 100) ? 4000:this.rotationSpeed; this.rotationInterval=setInterval(this.sliderRotate.bind(this),slide_interval); }}; SalientRecentProjectsFullScreen.prototype.splitLineText=function(){ var $slideClass=(this.$el.find('.project-slides').length > 0) ? '.project-slide':'.nectar-recent-post-slide'; var $slideInfoClass=(this.$el.find('.project-slides').length > 0) ? '.project-info h1':'.inner-wrap h2 a'; this.$el.find($slideClass).each(function(i){ $(this).find($slideInfoClass).each(function(){ var textArr=$(this).text(); textArr=textArr.trim(); textArr=textArr.split(' '); $(this)[0].innerHTML=''; for(var i=0;i '; }}); $(this).find($slideInfoClass + ' > span').wrapInner(''); }); }; SalientRecentProjectsFullScreen.prototype.sliderInit=function(){ var $projLength=this.$el.find('.project-slide').length; var self=this; if(this.rotationSpeed!=0){ var slide_interval=(this.rotationSpeed < 100) ? 4000:this.rotationSpeed; this.rotationInterval=setInterval(this.sliderRotate.bind(this),slide_interval); } this.$el.find('.zoom-slider-controls .next').on('click',function(){ var $that=$(this); if(!$that.parent().hasClass('timeout')){ setTimeout(function(){ $that.parent().removeClass('timeout'); },1150); } if($(this).parent().hasClass('timeout')){ return false; } $(this).parent().addClass('timeout'); self.sliderResetRotate(self.$el.bind(self)); var $current=$(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current'); var $sliderInstance=$(this).parents('.nectar_fullscreen_zoom_recent_projects'); $sliderInstance.find('.project-slide').removeClass('next').removeClass('prev'); $sliderInstance.find('.project-slide').each(function(i){ if(i < $current.index()+1&&$current.index()+1 < $projLength){ $(this).addClass('prev'); }else{ $(this).addClass('next'); }}); if($current.index()+1===$projLength){ $sliderInstance.find('.project-slide:first-child').addClass('no-trans'); } setTimeout(function(){ if($current.index()+1===$projLength){ $sliderInstance.find('.project-slide:first-child') .removeClass('no-trans') .removeClass('next') .removeClass('prev') .addClass('current'); $sliderInstance.find('.project-slide:last-child') .removeClass('next') .removeClass('current') .addClass('prev'); }else{ $current .next('.project-slide') .removeClass('next') .removeClass('prev') .addClass('current'); $current .removeClass('current') .addClass('prev'); } if($sliderInstance.find('.dot-nav').length > 0){ $sliderInstance.find('.dot-nav span.active').removeClass('active'); $sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active'); }},30); return false; }); this.$el.find('.zoom-slider-controls .prev').on('click',function(){ var $that=$(this); if(!$that.parent().hasClass('timeout')){ setTimeout(function(){ $that.parent().removeClass('timeout'); },1150); } if($(this).parent().hasClass('timeout')){ return false; } $(this).parent().addClass('timeout'); self.sliderResetRotate(self.$el.bind(self)); var $current=$(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current'); var $sliderInstance=$(this).parents('.nectar_fullscreen_zoom_recent_projects'); $sliderInstance.find('.project-slide').removeClass('next').removeClass('prev'); $sliderInstance.find('.project-slide').each(function(i){ if(i < $current.index()||$current.index()==0){ $(this).addClass('prev'); }else{ $(this).addClass('next'); }}); if($current.index()==0){ $sliderInstance.find('.project-slide:last-child').addClass('no-trans'); } setTimeout(function(){ if($current.index()==0){ $sliderInstance.find('.project-slide:last-child') .removeClass('no-trans') .removeClass('next') .removeClass('prev') .addClass('current'); $sliderInstance.find('.project-slide:first-child') .removeClass('next') .removeClass('prev') .removeClass('current') .addClass('next'); }else{ $current.prev('.project-slide').removeClass('next').removeClass('prev').addClass('current'); $current.removeClass('current').addClass('next'); } if($sliderInstance.find('.dot-nav').length > 0){ $sliderInstance.find('.dot-nav span.active').removeClass('active'); $sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active'); }},30); return false; }); this.$el.find('> .normal-container > .dot-nav').remove(); this.$el.find('> .normal-container').append('
'); for(var $i=0;$i < $projLength;$i++){ if($i==0){ this.$el.find('.dot-nav').append(''); }else{ this.$el.find('.dot-nav').append(''); }} var $dotIndex=1; this.$el.find('.dot-nav > span').on('click',function(){ if($(this).hasClass('active')){ return; } var $that=$(this); if(!$that.parent().hasClass('timeout')){ setTimeout(function(){ $that.parent().removeClass('timeout'); },1150); } if($(this).parent().hasClass('timeout')){ return; } $(this).parent().addClass('timeout'); self.sliderResetRotate(self.$el.bind(self)); $(this).parent().find('span.active').removeClass('active'); $(this).addClass('active'); $dotIndex=$(this).index() + 1; var $current=$(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current'); var $sliderInstance=$(this).parents('.nectar_fullscreen_zoom_recent_projects'); var $prevIndex=$current.index() + 1; $sliderInstance.find('.project-slide').removeClass('next').removeClass('prev'); $sliderInstance.find('.project-slide').each(function(i){ if(i < $dotIndex-1){ $(this).addClass('prev'); }else{ $(this).addClass('next'); }}); if($prevIndex > $dotIndex){ $sliderInstance.find('.project-slide') .eq($dotIndex-1) .addClass('no-trans') .addClass('prev') .removeClass('next'); setTimeout(function(){ $sliderInstance.find('.project-slide') .eq($dotIndex-1) .removeClass('no-trans') .removeClass('next') .removeClass('prev') .addClass('current'); $current .removeClass('current') .addClass('next'); },30); }else{ $sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('next').removeClass('prev'); setTimeout(function(){ $sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current'); $current.removeClass('current').addClass('prev'); },30); }}); }; function SalientRecentProjectsCarousel(el){ this.$el=el; this.carouselInit(); this.resizeHandler(); } SalientRecentProjectsCarousel.prototype.resizeHandler=function(){ $(window).resize(this.carouselHeightCalcs.bind(this)); }; SalientRecentProjectsCarousel.prototype.carouselInit=function(){ var $that=this.$el; var self=this; var maxCols=(this.$el.parents('.carousel-wrap').attr('data-full-width')==='true') ? 'auto':3 ; var scrollNum=(this.$el.parents('.carousel-wrap').attr('data-full-width')==='true') ? 'auto':'' ; var colWidth=(this.$el.parents('.carousel-wrap').attr('data-full-width')==='true') ? 500:453 ; var scrollSpeed, easing; var $autoplayBool=(this.$el.attr('data-autorotate')==='true') ? true:false; var $themeSkin, $themeSkin2; if($('body.ascend').length > 0&&this.$el.parents('.carousel-wrap').attr('data-full-width')!=='true' || $('body.material').length > 0&&this.$el.parents('.carousel-wrap').attr('data-full-width')!=='true'){ if(this.$el.find('li').length % 3===0){ $themeSkin=true; $themeSkin2=true; }else{ $themeSkin=false; $themeSkin2=true; }}else{ $themeSkin=true; $themeSkin2=true; } (parseInt(this.$el.attr('data-scroll-speed'))) ? scrollSpeed=parseInt(this.$el.attr('data-scroll-speed')):scrollSpeed=700; (this.$el.is('[data-easing]')) ? easing=this.$el.attr('data-easing'):easing='linear'; this.$el.find('.col').each(function(){ if($(this).has('[data-project-color]')){ $(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color')); }}); var $element=$that; if($that.find('img').length===0){ $element=$('body'); } imagesLoaded($element,function(){ $that.carouFredSel({ circular: $themeSkin, infinite: $themeSkin2, height:'auto', responsive: true, items:{ width:colWidth, visible:{ min:1, max:maxCols }}, swipe:{ onTouch:true, onMouse:true, options:{ excludedElements: "button, input, select, textarea, .noSwipe", tap: function(event, target){ if($(target).attr('href') && !$(target).is('[target="_blank"]') && !$(target).is('[data-fancybox^="group_"]') && !$(target).is('[rel^="prettyPhoto"]') && !$(target).is('.magnific-popup') && !$(target).is('.magnific')){ window.open($(target).attr('href'), '_self'); }} }, onBefore:function(){ $that.find('.work-item').trigger('mouseleave'); $that.find('.work-item .work-info a').trigger('mouseup'); }}, scroll: { items:scrollNum, easing:easing, duration:scrollSpeed, onBefore:function(data){ if($('body.ascend').length > 0&&$that.parents('.carousel-wrap').attr('data-full-width')!='true' || $('body.material').length > 0&&$that.parents('.carousel-wrap').attr('data-full-width')!='true'){ $that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); }}, onAfter:function(data){ if($('body.ascend').length > 0&&$that.parents('.carousel-wrap').attr('data-full-width')!='true' || $('body.material').length > 0&&$that.parents('.carousel-wrap').attr('data-full-width')!='true'){ $that.parents('.carousel-wrap').find('.item-count .current').html($that.triggerHandler('currentPage') +1); $that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length)); }} }, prev:{ button:function(){ return $that.parents('.carousel-wrap').find('.carousel-prev'); }}, next:{ button:function(){ return $that.parents('.carousel-wrap').find('.carousel-next'); }}, auto:{ play: $autoplayBool }}, { transition: true }).animate({'opacity': 1},1300); $that.parents('.carousel-wrap').wrap('