Skip to content

Commit

Permalink
Combined UI Fixes
Browse files Browse the repository at this point in the history
phone overlap bug fix + scroll-locker feature added
  • Loading branch information
benmcmahon100 committed Jul 2, 2015
1 parent 580e2e3 commit 5cedb09
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions public/js/main_0.0.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,48 @@ $(document).ready(function() {
});
};

//fakeiphone positioning hotfix
if($('.iphone-position').html() !==undefined || $('.iphone').html() !== undefined){
var startIphonePosition = parseInt($('.iphone-position').css('top').replace('px', ''));
var startIphone = parseInt($('.iphone').css('top').replace('px', ''));
$(window).on('scroll', function(){
if((($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height()) <= 0){
$('.iphone-position').css('top', startIphonePosition+(($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height()));
$('.iphone').css('top', startIphonePosition+(($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height())+120);
}
else{
$('.iphone-position').css('top', startIphonePosition);
$('.iphone').css('top', startIphone);
}
});
}

if($('.scroll-locker') != undefined){
function lockTop(initOff){
$(window).scroll(function() {
if ($(window).width() >= 992) {
if ((($('.scroll-locker').offset().top - $(window).scrollTop()) + $('.scroll-locker').height()) >= ($('.fcc-footer').offset().top - $(window).scrollTop())) {
$('.scroll-locker').css('position', 'fixed').css('top', initOff).css('width', $($('.scroll-locker').parent()).width()).css('max-height', '75%').css('overflow-y', 'auto').css('overflow-x', 'hidden');
$('.well').css('margin-right', '6px');
}
else {
$('.scroll-locker').css('position', 'fixed').css('bottom', $('.fcc-footer') - (($('.scroll-locker').offset().top - $(window).scrollTop()) + $('.scroll-locker').height()) - ($('.fcc-footer').offset().top - $(window).scrollTop())).css('width', $($('.scroll-locker').parent()).width()).css('max-height', '75%').css('overflow-y', 'auto').css('overflow-x', 'hidden');
$('.well').css('margin-right', '6px');
}
}
else {
$('.scroll-locker').css('position', 'inherit').css('top', 'inherit').css('width', '100%').css('max-height', '').css('overflow-y', 'auto').css('overflow-x', 'hidden');
$('.well').css('margin-right', '');
}
});
}
var initOff = ($('.scroll-locker').offset().top - $(window).scrollTop());
lockTop(initOff);
$(window).on('resize', function(){
lockTop(initOff);
});
}

$('#comment-button').on('click', commentSubmitButtonHandler);
});

Expand Down

0 comments on commit 5cedb09

Please sign in to comment.