Skip to content

Instantly share code, notes, and snippets.

@whistlerbrad
Last active June 12, 2017 19:28
Show Gist options
  • Select an option

  • Save whistlerbrad/53f9b286a59264f90e128ee9193922e8 to your computer and use it in GitHub Desktop.

Select an option

Save whistlerbrad/53f9b286a59264f90e128ee9193922e8 to your computer and use it in GitHub Desktop.
shop.js.liquid changes for Mobile Scroll
pipeline.fullHeight = function(){
if ((/Android|iPhone|iPad|iPod|BlackBerry/i).test(navigator.userAgent || navigator.vendor || window.opera)) {
return;
}
else {
var windowHeight = $(window).height();
var navHeight = ($('.header__wrapper').height());
var heroHeight = windowHeight - navHeight;
$('.index-sections > .shopify-section:first-child > .use_screen_full').height(heroHeight);
$('.index-sections > .shopify-section:first-child > .use_screen_full.homepage-slideshow .slideshow__slide').height(heroHeight);
}
};
pipeline.contentOverflow = function(){
$('.preventOverflow').css('min-height', function() {
var contentHeight = $(this).find('.preventOverflowContent').height();
return (contentHeight + 30);
});
};
pipeline.heightOverride = function(){
if ((/Android|iPhone|iPad|iPod|BlackBerry/i).test(navigator.userAgent || navigator.vendor || window.opera)) {
var windowHeight = $(window).height();
var windowHeightFull = ((windowHeight * 1.1) + "px");
var windowHeightTwoThirds = ((windowHeight * 0.72) + "px");
$( '.use_screen_full').each(function () {
this.style.setProperty( 'height', windowHeightFull, 'important' );
});
$( '.use_screen_two_thirds .slideshow__slide').each(function () {
this.style.setProperty( 'height', windowHeightTwoThirds, 'important' );
});
}
};
pipeline.matchHeight = function(){
$('.equalOverflowHeight').css('min-height', function() {
var blockHeights = $('.preventOverflowContent').map(function() {
return $(this).height();
}).get();
var tallest = Math.max.apply(null, blockHeights);
return (tallest + 30);
});
};
pipeline.moveTags = function(){
$('.homepage--white:not(.homepage-image)').parent().addClass('adjust--white');
$('.homepage--light:not(.homepage-image)').parent().addClass('adjust--light');
$('.homepage--splash:not(.homepage-image)').parent().addClass('adjust--splash');
$('.homepage--dark:not(.homepage-image)').parent().addClass('adjust--dark');
};
$(window).resize(function() {
pipeline.detectNav();
pipeline.contentOverflow();
pipeline.equalHeight();
pipeline.matchHeight();
pipeline.fullHeight();
}).resize();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment