Created
October 8, 2014 23:27
-
-
Save bryanmonzon/7684fbf735d6c8303dfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////// | |
// Set Variables | |
/////////////////////////////// | |
var gridContainer = jQuery('.thumbs'); | |
var colW; | |
var gridGutter = 0; | |
var thumbWidth = 350; | |
var widgetsHidden = false; | |
var themeColumns = 3; | |
var catptionOffset = -20; | |
/////////////////////////////// | |
// Mobile Detection | |
/////////////////////////////// | |
function isMobile(){ | |
return ( | |
(navigator.userAgent.match(/Android/i)) || | |
(navigator.userAgent.match(/webOS/i)) || | |
(navigator.userAgent.match(/iPhone/i)) || | |
(navigator.userAgent.match(/iPod/i)) || | |
(navigator.userAgent.match(/iPad/i)) || | |
(navigator.userAgent.match(/BlackBerry/)) | |
); | |
} | |
/////////////////////////////// | |
// Sticky Nav Offset | |
/////////////////////////////// | |
function setStickyNavOffset(){ | |
if(!jQuery('body').hasClass('home')){ | |
jQuery('#header').css('height', jQuery('#header .top').height() ); | |
} | |
} | |
/////////////////////////////// | |
// SlideNav | |
/////////////////////////////// | |
function setSlideNav(){ | |
jQuery(".menuToggle").pageslide({ direction: "left"}); | |
} | |
function setHeaderBackground() { | |
var scrollTop = jQuery(window).scrollTop(); // our current vertical position from the top | |
if (scrollTop > 300 || jQuery(window).width() < 700) { | |
jQuery('#header .top').addClass('solid'); | |
} else { | |
jQuery('#header .top').removeClass('solid'); | |
} | |
} | |
/////////////////////////////// | |
// Project Filtering | |
/////////////////////////////// | |
function projectFilterInit() { | |
jQuery('#filterNav a').click(function(){ | |
var selector = jQuery(this).attr('data-filter'); | |
jQuery('#projects .thumbs').isotope({ | |
filter: selector, | |
hiddenStyle : { | |
opacity: 0, | |
} | |
}); | |
if ( !jQuery(this).hasClass('selected') ) { | |
jQuery(this).parents('#filterNav').find('.selected').removeClass('selected'); | |
jQuery(this).addClass('selected'); | |
} | |
return false; | |
}); | |
} | |
/////////////////////////////// | |
// Project thumbs | |
/////////////////////////////// | |
function projectThumbInit() { | |
setColumns(); | |
gridContainer.isotope({ | |
resizable: false, | |
layoutMode: 'fitRows', | |
masonry: { | |
columnWidth: colW | |
} | |
}); | |
jQuery(".thumbs .small").css("visibility", "visible"); | |
} | |
/////////////////////////////// | |
// Isotope Grid Resize | |
/////////////////////////////// | |
function setColumns() | |
{ | |
var columns; | |
if(gridContainer.width()<=700){ | |
columns = 1; | |
colW = Math.floor(gridContainer.width() / columns); | |
jQuery('.thumbs .small').each(function(id){ | |
jQuery(this).css('width','100%'); | |
jQuery(this).css('max-width','100%'); | |
}); | |
} | |
else{ | |
columns = 3; | |
colW = Math.floor(gridContainer.width() / columns); | |
jQuery('.thumbs .small').each(function(id){ | |
jQuery(this).css('width',colW+'px'); | |
}); | |
} | |
jQuery('.thumbs .small').show(); | |
} | |
function gridResize() { | |
setColumns(); | |
gridContainer.isotope({ | |
resizable: false, | |
layoutMode: 'fitRows', | |
masonry: { | |
columnWidth: colW | |
} | |
}); | |
} | |
/////////////////////////////// | |
// Center Home Flexslider Text | |
/////////////////////////////// | |
function centerFlexCaption() { | |
jQuery('.home .slideshow .details').each(function(id){ | |
jQuery(this).css('margin-top','-'+((jQuery(this).actual('height')/2)-catptionOffset)+'px'); | |
jQuery(this).show(); | |
}); | |
} | |
/////////////////////////////// | |
// Initialize | |
/////////////////////////////// | |
jQuery.noConflict(); | |
jQuery(document).ready(function(){ | |
//Stuff that happens after images are loaded | |
jQuery('#container').imagesLoaded(function(){ | |
centerFlexCaption(); | |
projectThumbInit(); | |
projectFilterInit(); | |
centerFlexCaption(); | |
}); | |
jQuery("#content").fitVids(); | |
jQuery(window).smartresize(function(){ | |
gridResize(); | |
centerFlexCaption(); | |
}); | |
setSlideNav(); | |
jQuery('img').attr('title',''); | |
jQuery('ul.sf-menu').superfish(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment