Skip to content

Instantly share code, notes, and snippets.

@NickDeckerDevs
Created April 25, 2017 14:59
Show Gist options
  • Save NickDeckerDevs/9e329dc38bfde16c24f7c2893754f3b8 to your computer and use it in GitHub Desktop.
Save NickDeckerDevs/9e329dc38bfde16c24f7c2893754f3b8 to your computer and use it in GitHub Desktop.
Skewered Beef Tips and corn nuggets
jQuery(document).ready(function($) {
function fixBandPositioning() {
if($('.band-wrapper.right').length > 0) {
if(window.outerWidth >= 784) {
var bandHeight = $('.band-wrapper.right').outerHeight();
var bandMargin = bandHeight / -Math.abs(4.233);
var bandMarginSkew = bandHeight / Math.abs(4.233);
bandMargin = (Math.round(bandMargin * 1000) / 1000) + 'px';
bandMarginSkew = (Math.round(bandMarginSkew *1000) / 1000) + 'px';
$('.band-wrapper.right').css('margin-left', bandMargin);
$('.band-wrapper.right > .band-skew').css('margin-left', bandMarginSkew);
} else {
var bandMargin = $('.band-wrapper.right').css('margin-left');
var bandMarginSkew = $('.band-wrapper.right > .band-skew').css('margin-left');
if(bandMargin != '0px') {
$('.band-wrapper.right').css('margin-left', '0px');
}
if(bandMarginSkew != '0px') {
$('band-wrapper.right > .band-skew').css('margin-left', '0px');
}
}
}
}
$(window).load(function() {
fixBandPositioning();
});
$(window).on('resize', function() {
fixBandPositioning();
});
function fixBandPositioningLeft() {
if($('.band-wrapper.left').length > 0) {
if(window.outerWidth > 784) {
var bandHeightL = $('.band-wrapper.left').outerHeight();
var bandMarginL = bandHeightL / Math.abs(4.233);
var bandMarginLSkew = bandHeightL / -Math.abs(4.233);
bandMarginL = (Math.round(bandMarginL * 1000) / 1000) + 'px';
bandMarginLSkew = (Math.round(bandMarginLSkew * 1000) / 1000) + 'px';
$('.band-wrapper.left').css('margin-left', bandMarginL);
$('.band-wrapper.left > .band-skew').css('margin-left', bandMarginLSkew);
} else {
var bandMarginL = $('.band-wrapper.left').css('margin-left');
var bandMarginLSkew = $('.band-wrapper.left > .band-skew').css('margin-left');
if(bandMarginL != '0px') {
$('.band-wrapper.left').css('margin-left', '0px');
}
if(bandMarginSLekew != '0px') {
$('band-wrapper.left > .band-skew').css('margin-left', '0px');
}
}
}
}
$(window).load(function() {
fixBandPositioningLeft();
});
$(window).on('resize', function() {
fixBandPositioningLeft();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment