Created
December 3, 2012 23:26
-
-
Save jaseflow/4199034 to your computer and use it in GitHub Desktop.
Sticky shit
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
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