I'm trying to get supersized not to crop images and stretch them to fill the background 100% in width and height (I don't care if the images get distorted).
I'm using fit_always
so the images don't get cropped and in the CSS:
#supersized img {
width:100%;
height:100%;
position:relative;
display:none;
outline:none;
border:none;
}
HTML
<script type="text/javascript">
jQuery(function($){
$.supersized({
// Functionality
slide_interval : 5000,
transition : 1,
transition_speed : 500,
horizontal_center : 0,
fit_always : 1,
// Components
slides : [ // Slideshow Images
{image : '/img/main/home.jpg'},
{image : '/img/main/home-2.jpg'},
{image : '/img/main/home-3.jpg'},
{image : '/img/main/home-4-test.jpg'},
{image : '/img/main/home-4.jpg'}
]
});
});
</script>
Works fine, but if I resize the browser window the width:100%
and height:100%
gets "forgotten"
What am I missing?
Have you tried "auto" instead of 100% ?
In my experience, the default settings for Supersized do just what you want, without anything like
fit_always
. In the demo code I have saved locally, the JS is like this:This problem can be happen for container width/height. You already set image width height to 100%. It will work. If your container isn't 100% in width/height then image can't be. If there is no container then use 100% for body,html.
Try this