Automatic Fullscreen Background Slideshow Plugin - Harper Banner
| File Size: | 19.8 KB |
|---|---|
| Views Total: | 3664 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
Harper Banner is an ultra-light jQuery plugin for creating a responsive fullscreen slideshow that automatically fades through a list of background images at a specific speed. The background images will automatically resize to fit the size of the viewport.
How to use it:
1. The required html structure for the background slideshow.
<div class="banner">
<div class="overlay"></div>
<ul class="slides">
<li data-background="1.jpg">
<div class="holder">
<h1>Slide 1</h1>
<h2>This is slide 1</h2>
</div>
</li>
<li data-background="2.jpg">
<div class="holder">
<h1>Slide 2</h1>
<h2>This is slide 2</h2>
</div>
</li>
<li data-background="3.jpg">
<div class="holder">
<h1>Slide 3</h1>
<h2>This is slide 3</h2>
</div>
</li>
</ul>
<ul class="controls"></ul>
</div>
2. Add the following CSS styles to your CSS file.
.banner ul.slides { background: rgba(0, 0, 0, 0.5); }
.banner ul.slides li, .banner .overlay {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
overflow: auto;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
-moz-background-size: cover;
-webkit-background-size: cover;
background-color: #464646;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.banner ul.slides li .holder, .banner .overlay .holder {
margin: 10% auto 0 auto;
padding: 50px;
width: 70%;
background: rgba(0, 0, 0, 0.5);
box-shadow: -1px -1px 0 #d4d4d4, 1px -1px 0 #d4d4d4, -1px 1px 0 #d4d4d4, 1px 1px 0 #d4d4d4, 2px 2px 2px #000000;
-webkit-border-radius: 34px 20px 20px 20px;
-moz-border-radius: 34px 20px 20px 20px;
border-radius: 34px 20px 20px 20px;
text-align: center;
}
.banner ul.slides li h1, .banner .overlay h1 {
margin: 0 auto;
color: #000000;
font-size: 80px;
text-align: center;
text-shadow: -1px -1px 0 #d4d4d4, 1px -1px 0 #d4d4d4, -1px 1px 0 #d4d4d4, 1px 1px 0 #d4d4d4, 2px 2px 2px #000000;
cursor: default;
}
.banner ul.slides li h2, .banner .overlay h2 {
margin: 0 auto;
color: #000000;
font-size: 30px;
text-align: center;
text-shadow: -1px -1px 0 #d4d4d4, 1px -1px 0 #d4d4d4, -1px 1px 0 #d4d4d4, 1px 1px 0 #d4d4d4, 2px 2px 2px #000000;
cursor: default;
}
.banner ul.controls {
margin-left: -50px;
position: absolute;
left: 50%;
bottom: 20px;
list-style: none;
padding-left: 0;
text-align: center;
}
.banner ul.controls li {
margin-right: 20px;
width: 20px;
height: 20px;
background: #000000;
float: left;
cursor: pointer;
box-shadow: -1px -1px 0 #d4d4d4, 1px -1px 0 #d4d4d4, -1px 1px 0 #d4d4d4, 1px 1px 0 #d4d4d4, 2px 2px 2px #000000;
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 50px;
-webkit-transition: background 0.2s ease-in-out;
-moz-transition: background 0.2s ease-in-out;
-o-transition: background 0.2s ease-in-out;
transition: background 0.2s ease-in-out;
-webkit-transition: background 0.2s ease-in-out;
-moz-transition: background 0.2s ease-in-out;
-o-transition: background 0.2s ease-in-out;
transition: background 0.2s ease-in-out;
}
.banner ul.controls li:hover, .banner ul.controls li.hover { background: #4D8CC4; }
.banner ul.controls li:last-child { margin-right: 0; }
.passion {
font-size: 20px;
vertical-align: middle;
}
3. Include jQuery library and the jQuery Harper Banner plugin at the bottom of the webpage.
<script src="//code.jquery.com/jquery.min.js"></script> <script src="dist/harper-banner.min.js"></script>
4. Call the function on the top container.
$('.banner').harper();
5. Set the delay in milliseconds between each background.
$('.banner').harper({
duration: 10000
});
Change log:
2016-08-30
- code refactoring.
This awesome jQuery plugin is developed by bluewebtech. For more Advanced Usages, please check the demo page or visit the official website.











