So I add the box called "booking-picker" which is supposed to scroll down with you on the page -- but it pushes all the elements that are below him whatever they are. FYI bootstrap used. http://jsfiddle.net/2m849oes/ or Here is the script:
<script>
$(function() {
var $sidebar = $("#flow-picker"),
$window = $(window),
offset = $sidebar.offset(),
topPadding = 15
$window.scroll(function() {
if ($window.scrollTop() > offset.top) {
$sidebar.stop().animate({
marginTop: $window.scrollTop() - offset.top + topPadding
});
} else {
$sidebar.stop().animate({
marginTop: 0
});
}
});
});
</script>
And here is the html:
<div class="container">
<div class="row">BLABLABLABLABLA ........
</div>
<div class="booking-picker" id="flow-picker">
<h3>Hello</h3>
ETC......
</div>
</div>
And later I have the footer which is pushed down too.
And here is the CSS
.booking-picker {
display: block;
float: right;
}
#flow-picker {
}
Thanks!