sebsimappus Posted December 11, 2016 Share Posted December 11, 2016 (edited) Hello For some days I am looking for a solution to my problem, the scroll does not stop before the footer: see screen prints. By cons when I reduce the page, and I enlarge the page it works perfectly with the function, repositionScrollingSidebar $(document).ready(function () { var $cartsummaryEl = jQuery("#cartsummary"); if ($cartsummaryEl.length) { var offset = jQuery("#scrollingPanelContainer").parent('.row').offset(); //var maxTopOffset = jQuery("#scrollingPanelContainer").parent('.row').outerHeight() - 35; var maxTopOffset = jQuery("#scrollingPanelContainer").parent('.row'); var topPadding = 70; jQuery(window).resize(function() { offset = jQuery("#scrollingPanelContainer").parent('.row').offset(); maxTopOffset = jQuery("#scrollingPanelContainer").parent('.row').outerHeight() - 35; repositionScrollingSidebar(); }); jQuery(window).scroll(function() { repositionScrollingSidebar(); }); repositionScrollingSidebar(); } function repositionScrollingSidebar() { if (jQuery("#scrollingPanelContainer").css('float') != 'left') { $cartsummaryEl.stop().css('margin-top', '0'); return false; } var heightOfcartsummary = $cartsummaryEl.outerHeight(); var newTopOffset = jQuery(window).scrollTop() - offset.top + topPadding; if (newTopOffset > maxTopOffset - heightOfcartsummary) { newTopOffset = maxTopOffset - heightOfcartsummary; } if (jQuery(window).scrollTop() > offset.top) { $cartsummaryEl.stop().animate({ marginTop: newTopOffset }); } else { $cartsummaryEl.stop().animate({ marginTop: 0 }); } } }); If someone has an idea thank you in advance Edited December 11, 2016 by sebsimappus 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.