I've been trying to get the contents of a div (an image, a search bar, and three buttons all stacked on top of each other) to fit into a div that has a css styling of the overflow being hidden. The CSS for the div is as follows:
.jumbotron {
overflow: hidden;
display: block;
padding: 0;
margin-bottom: 0;
background: #000000 url('../landing_background.jpg') no-repeat center center fixed;
background-size: cover;
position:relative;
}
Some javascript that could fix it would be:
Parallax.prototype.translateBgImage = function() {
var scrollPos = $(window).scrollTop();
var pagecoverHeight = this.$element.height();
if (this.$element.attr('data-pages-bg-image')) {
var relativePos = this.$element.offset().top - scrollPos;
// if element is in visible window's frame
if (relativePos > -pagecoverHeight && relativePos <= $(window).height()) {
var displacePerc = 100 - ($(window).height() - relativePos) / ($(window).height() + pagecoverHeight) * 100;
this.$element.css({
'background-position': 'center ' + displacePerc + '%'
});
}
}
}