Wallpaper

A jQuery plugin for smooth-scaling image and video backgrounds.

Current Version: 3.1.18


Installation

Include the following resources on your page before initializing:

<script src="jquery.fs.wallpaper.js"></script>
<link href="jquery.fs.wallpaper.css" rel="stylesheet">

Bower

You can deploy and update via the command line with Bower:

bower install Wallpaper

Options

Options are set by passing a valid options object at initialization or to the public "defaults" method. You can also set custom options for a specific instance by attaching a data-boxer-options attribute containing a properly formatted JSON object to the target element.

Name Type Default Description
autoPlay boolean true Autoplay video
embedRatio number 1.777777 Video / embed ratio (16/9)
hoverPlay boolean false Play video on hover
loop boolean true Loop video
mute boolean true Mute video
onLoad function $.noop On load callback
onReady function $.noop On ready callback
source string | object null Source image (string or object) or video (object) or YouTube (object)

Events

Events are triggered on the target instance's element, unless otherwise stated.

Option Description
wallpaper.loaded Source media loaded

Methods

Methods are publicly available to all active instances, unless otherwise stated.

defaults

Sets default plugin options

$.wallpaper("defaults", opts);
Parameter Type Default Description
opts object {} Options object

destroy

Removes instance of plugin

$(".target").wallpaper("destroy");

load

Loads source media

$(".target").wallpaper("load", "path/to/image.jpg");
Parameter Type Default Description
source string | object Source image (string) or video (object) or YouTube (object); { source: { poster: <"">, video: <"" or {}> } }

pause

Pauses target video

$(".target").wallpaper("stop");

play

Plays target video

$(".target").wallpaper("play");

unload

Unloads current media

$(".target").wallpaper("unload");