BxSlider Full Screen Size

In this example below you will see how to do a BxSlider Full Screen Size with some HTML / CSS and Javascript

Full Screen BxSlider - adaptive to screen height and width

Thumbnail
This awesome code was written by jhawes, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright jhawes ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>BxSlider Full Screen Size</title>
  
  
  <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='https://s3-us-west-2.amazonaws.com/s.cdpn.io/85807/jquery.bxslider.css'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  
<div class="classy">
  <ul class="bxslider">
    <li class="one"></li>
    <li class="two"></li>
    <li class="three"></li>
  </ul>
</div>
  <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
<script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/85807/jquery.easing.js'></script>
<script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/85807/jquery.bxslider.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/jhawes/bxslider-full-screen-size-vKyXRw */
.bxslider li {
  min-height: 100vh;
}
.bxslider li.one {
  background: url(https://images.unsplash.com/photo-1465205568425-23fdd3805e49?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=7e476dbc9096ec1c869bd2cb97d82c70) center center;
  -moz-background-size: cover;
  -o-background-size: cover;
  -webkit-background-size: cover;
  background-size: cover;
}
.bxslider li.two {
  background: url(https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=61282cfeed75871385c84c2a44a8e594) center center;
  -moz-background-size: cover;
  -o-background-size: cover;
  -webkit-background-size: cover;
  background-size: cover;
}
.bxslider li.three {
  background: url(https://images.unsplash.com/photo-1463392898715-3939d4ab1019?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=da848bfb85b0ee6989e1c4bec6388ce4) center center;
  -moz-background-size: cover;
  -o-background-size: cover;
  -webkit-background-size: cover;
  background-size: cover;
}

.bx-wrapper .bx-viewport {
  left: 0;
  border: none;
  box-shadow: none;
}

ul, ul li {
  margin: 0;
  padding: 0;
}


/*Downloaded from https://www.codeseek.co/jhawes/bxslider-full-screen-size-vKyXRw */
$(document).ready(function() {
	$('.bxslider').bxSlider({
		mode : 'fade',
		auto: true,
		pause: 4000,
		controls: false
	});
	var windowWidth = $(window).width(),
		windowHeight = $(window).height(),
		adjHeight = windowHeight;
	$('.classy').css({
		'width': windowWidth + 'px',
		'height': adjHeight + 'px'
	});
});
$(window).resize(function() {
	var windowWidth = $(window).width(),
		windowHeight = $(window).height(),
		adjHeight = windowHeight;
	$('.classy').css({
		'width': windowWidth + 'px',
		'height': adjHeight + 'px'
	});
	$('.classy video').css({
		'min-width': windowWidth + 'px',
		'min-height': adjHeight + 'px'
	});
});

Comments