Skip to content

jQuery plugin to create bootstrap carousel easily

License

Notifications You must be signed in to change notification settings

mwasim164/wslider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wslider

A simple jQuery plugin to easily create bootstrap carousels

Getting Started

You need to just download the zip file and extract it, then include wslider.js or wslider.min.js file into your html file and you are ready to go.

Prerequisites

To use this plugin you must include bootstrap (bootstrap.css and bootstrap.js) and jQuery (jquery.js) files into your project.

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8"> 
  <title>wslider demo</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>	
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>

Installing

Follow the following steps to use this plugin

1. Include plugin into your html file

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

2. Create a
in which you want to wrap your slider

    <div id="wslider"></div>	

3. Create a JSON array containing urls of images for your slider and pass it to wslider in order to intialize wslider plugin.


Below is the example of how to use plugin with minimum options
    <script type="text/javascript">
		$(document).ready(function(){
			var slides=
			[	
				{
					image:'slide1.jpg'
				},
				{
					image:'slide2.jpg'
				}
			];
			$('#slider').wslider({slides:slides});			
						
		});		 
	</script>	


Here is an example with all option
	<script type="text/javascript">
		$(document).ready(function(){
			var slides=
			[	
				{
					image:'slide1.jpg',
					alt:'wslide 1',
					title:'Slide 01',
					description:'This is slide no 01'
				},
				{
					image:'slide2.jpg',
					alt:'wslide 2',
					title:'Slide 02',
					description:'This is slide no 02'
				},
				
			];
			$('#slider').wslider(
			{
				slides:slides,
				next_text:'Next Slide',
				previous_text:'Prev Slide',
				interval:3000,
				pause_on_hover:true,
				cycle:true
			});			
						
		});		 
	</script>

Details of options

slides(array) - array containing urls of images to show in slider
image(string) - url of image to display in slider
alt(string) - alternate text for image [optional]
title(string) - heading or title of slide [optional]
description(string) - sub heading or details about slide [optional]

next_text(string) - text to display for next slide control [optional]
previous_text(string) - text to display for previous slide control [optional]
interval(number) - number of milliseconds after which slide change [optional]
pause_on_hover(boolean) - whether the slider should pause on mouse hover or not [optional]
cycle(boolean) - whether the slider should go through all slides continuously, or stop at the last slide [optional]

Default values are as follows

	defaultSetting={
			slides:[],
			next_text:'Next',
			previous_text:'Previous',
			interval:5000,
			pause_on_hover:'hover',
			cycle:true
		}

View Demo

Built With

  • Bootstap - Use to build responsive web app
  • jQuery - Javascript library

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details