Q:

How to set the width and height as per container sizes?

I have build a carousel but I want to make it responsive so when I resize the window it should resize itself.
I am using the following lines of code where I set the sizes but I want to do it by itself.
https://jsfiddle.net/6nhuk7vm/4/
var slideWidth = 1200;
var slideHeight = 300;
$('#slidesHolder').css('width', slideWidth * numberOfSlides);
$('#slidesHolder').css('height', slideHeight);

A:

This should help, On resizing a function is triggered which adjusts all other height and width
$( window ).resize(function() {
    slideWidth = $(window).width();
    slideHeight = $(window).height();
    $('#slidesHolder').css('width', slideWidth * numberOfSlides);
    $('#slidesHolder').css('height', slideHeight);
    $('.img_tag').css('height', slideHeight);//change of height of image
    $('.img_tag').css('width', slideWidth);//change width of image
});

Also add this style
.slide{
   max-height:100%;
   max-width:100%;
}

