Basic Full-width Image Slider Plugin with jQuery

File Size: 4.46 KB
Views Total: 4706
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Basic Full-width Image Slider Plugin with jQuery

A basic jQuery slider plugin for creating a responsive, full-width, infinite-looping image carousel with a simple bullet navigation.

How to use it:

1. Load the necessary jQuery JavaScript library in the document.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>

2. Build the Html structure for the image slider.

<div id="splash">
  <section> <img src="1.jpg" alt="Example 1">
    <div>
      <h1>Title 1</h1>
      <h2>Description 1</h2>
    </div>
  </section>
  <section> <img src="2.jpg" alt="Example 2">
    <div>
      <h1>Title 2</h1>
      <h2>Title 2</h2>
    </div>
  </section>
  <section> <img src="3.jpg" alt="Example 3">
    <div>
      <h1>Title 3</h1>
      <h2>Title 3</h2>
    </div>
  </section>
</div>

3. Load the BJSlider.js after jQuery library.

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

4. The core CSS styles for the image slider.

#splash {
  position: relative;
  height: 400px;
  overflow: hidden;
}

#splash img {
  position: absolute;
  left: -100%;
  top: -100%;
  right: -100%;
  bottom: -100%;
  margin: auto;
  min-width: 600px;
}

#splash > section {
  display: none;
  height: 400px;
}

#splash div {
  position: relative;
  z-index: 2;
}

#splash_nav {
  width: 100%;
  position: relative;
  float: left;
  text-align: center;
  min-height: 18px;
  margin: 10px 0 0;
}

#splash_nav ul { margin: 0; }

#splash_nav li {
  display: inline-block;
  width: 8px;
  -webkit-transition: none;
  -moz-transition: none;
  -o-transition: none;
  -ms-transition: none;
  transition-duration: none;
  height: 8px;
  border-radius: 4px;
  background-color: #ccc;
  margin: 5px;
  cursor: pointer;
}

#splash_nav li:hover { background-color: #777; }

#splash_nav li.active { background-color: #222; }

This awesome jQuery plugin is developed by fran-diaz. For more Advanced Usages, please check the demo page or visit the official website.