Skip to content

Instantly share code, notes, and snippets.

@jaseflow
Created December 3, 2012 23:26
Show Gist options
  • Save jaseflow/4199034 to your computer and use it in GitHub Desktop.
Save jaseflow/4199034 to your computer and use it in GitHub Desktop.
Sticky shit
var dealRowHeight = $('tr.deals').height(),
tableWidth = $('.matrix').width(),
totalDealRows = $('.deals').length;
gridHeaderHeight = $('.grid-header').height();
matrixDividerHeight = $('.matrix-divider').height();
dealsOffset = $('.wothotel').offset();
matrixOffset = $('.matrix').offset();
$('body').on('click', '.toggle-map', function() {
$('.map').toggle();
$('.map').css({
'height': (dealRowHeight*totalDealRows) + 'px',
'width': (tableWidth-300) + 'px',
'top': (gridHeaderHeight+matrixDividerHeight) + 'px'
});
});
$('.wothotel').next('.deals').waypoint(function(event,direction) {
console.log(direction);
if (direction == 'down') {
$('.map').css({position:'fixed', top:0});
}
else if (direction == 'up') {
$('.map').css({position:'absolute', top: (gridHeaderHeight+matrixDividerHeight) + 'px', left: 300});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment