BkgSlider

BkgSlider is a jQuery plugin giving you the opportunity to have a CSS background-image gallery.

Demo

You can check out an example on the demonstration page.

Usage

There’s nothing simpler than to use BkgSlide : you just have to include the jQery library and the BkgSlider plugin in your page and instanciate the plugin with its options.

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.bkgslide.js"> </script>
<script type="text/javascript">
$(document).ready(function(){
    $('#target').bkgSlide({
        images: ['images/img1.jpg', 'images/img2.jpg']
    });
});

Options

images

An array containing the name of the images to use.

imagePath

The path where to find the images.
The script automatically adds an ending slash if necessary.

speed

The duration in milliseconds between two image changes.
Default : 7000
If you don’t want autoplay, set this value to 0.

direction

The direction to go to when changing image.
Possible values : ‘random’, ‘next’, ‘prev’
Default : ‘random’

wrap

Defines wheter or not to wrap around when reaching one end of the imges list.
Default : true

nav

Defines the navigation tools.
Possible values : true, an option as a string, an array of navigation tools in the order you want to see them

true / ‘all’ : all the navigation tools
‘list’ : list of shortcuts to each image
‘prev’ : button to go to the previous image
‘next’ : bbutton to go to the next image
‘toggle’ : button to start or stop the slideshow

Default : ['prev', 'list', 'next', 'toggle']

stopOnNav

Defines wheter or not to stop the slideshow when the user interacts with one of the navigation tools.
Default : false

width

The width to give to the image containers.
With the ‘auto’ value, the script will use the width of the target element.
Default : ‘auto’

height

The height to give to the image containers.
With the ‘auto’ value, the script will use the height of the target element.
Default : ‘auto’

containersClass

Used to add a custom class to the image containers.
Default : null

effect

The effect to apply when transitioning between two images.
Possible values : ‘fadeOut’, ‘slideUp’, ‘hide’
Default : ‘fadeOut’

duration

The transition duration between two images (in milliseconds)
Default : 500

afterInit

A callback function to do something right after the BkgSlider initialization.
This function will have has parameter the target element and its BkgSlider.

Methods

move

Move within the images list.
Possible values : ‘next’, ‘prev’, ‘random’
If no parameter is passed, the direction set in the options is used.

changeTo

Move to the specified image index.
This method requires the index of the image in the array as a parameter (a number between 0 and the number of images -1).

play

Begin the slideshow.
This method accepts a number of milliseconds as a parameter, representing the time interval between two image changes.
If no parameter is passed, the speed set in the options will be used.

stop

Stop the slideshow.

8 thoughts on “BkgSlider

  1. This is a great script, however there is a small issue. If you are using a sticky-footer so the footer stays at the bottom of your page, then BKGSLIDER does not work.

    The issue appears to be with the CSS:

    html, body {height: 100%;}

    Unfortunately this must remain intact, so BKGSLIDER will not function. Any suggestions on a workaround?

  2. Hi Adrian,
    Thanks for the comment. Can you give more details on your issue ? Ideally a test case would help solve the problem. Defining “does not work” and which browser is concerned might help too… The script uses relative positioning, and I assume your sticky-footer uses a fixed/absolute positioning too, so it’s probably just a matter of having them work well together.

  3. I have only tested it in Chrome, Firefox and Safari and get the same results on all of them. Basically I get the navigation to appear, but the background image itself is not showing up. Here is an example:

    http://bit.ly/eNBvAE

    The sticky footer uses relative positioning as well. That’s why I have been a little confused.

    If I remove the body{height:100%} from the CSS, the slideshow functions perfectly, except the footer jumps up to the bottom of the content.

    http://bit.ly/goSNz0

    I know it’s probably something simple that I’m just missing.

  4. Hi,great plugin works flawlessly in firefox and chrome.I have noticed a bug in ie

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)
    Timestamp: Fri, 3 Jun 2011 08:36:10 UTC

    Message: ‘undefined’ is null or not an object
    Line: 385
    Char: 13
    Code: 0
    URI: http://www.ringabell.org/wp-content/_custom/bkgslide/js/jquery.bkgslide-1.0.3.js

    It seems this stops the background image auto rotating, any advice?

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

Top of page