#windowPane.js
##Overview
Create a seamless "window-pane" effect using only one image.
##Usage
To use this plugin you must include:
- jQuery
- windowPane.js
Example Initialization:
$("#wrapper").windowPane({
windowPane: ".box",
image: "img/landscape.jpg”
});
Notes on Responsive Pages:
If you want to incorporate windowPane.js on a responsive page, you will need to use a media query event listener such as enquire.js, and re-initialize the plugin. This allows you to also utilize a unique image optimized for each media query.
##Options
A few options are required, while others allow customization of windowPane.js behavior:
###windowPane
required
default: none
CSS selector of all elements to be used as "window panes"
###insertInto
optional
default: windowPane selector
CSS selector of elements that will display the image as their background. Only necessary if you want to use the image on a child element of the "window pane". Currently only supports child elements that fill the "window pane".
Example: animation that reveals a different child element on rollover.
###image
required
default: none
Document relative link to the image displayed across "window panes". If you're using the slideshow functionality, this will be an array of links.
###bgRepeat
optional
default: "no-repeat"
CSS background-repeat argument to use on the background image.
###revealRollovers
optional
default: false
Automatically reveals any elements that are not covered by the background image. Useful in a responsive page if bgRepeat isn't practical.
###slideshowSpeed
optional
default: 5000
Time (in milliseconds) to wait before auto advancing slides.
###slideSpeed
optional
default: 1000
Time (in milliseconds) for the slide animation to last.
###autoAdvance
optional
default: false
Starts an automatically advancing slideshow.
###slideDirection
optional
default: "next"
Direction to slide when auto advancing ("next" or "prev").
###slideStyle
optional
default: "single"
Animation style for slides. "single" will move the background image as one unit. "separate" will move each "window-pane" separately. See the demo pages to clarify this difference.
###onSlide
optional
default: none
Function that executes when slide is changed. Passes direction, and number of times the slide is executed. For example
onSlide: function (direction, times, currentSlide) {
console.log("I moved ", direction, " ", times, " times!");
console.log("Currently on slide #", currentSlide);
}
If the slide is triggered to move "next" 5 times, starting from the first, it will print: "I moved next 5 times!" "Currently on slide #6"
###includeNav
optional
default: false
Includes navigation functionality ("prev"/"next" style buttons).
###navPrev
optional
default: ".nav-prev"
CSS selector that controls the "prev" action.
###navNext
optional
default: ".nav-next"
CSS selector that controls the "next" action.
###includeNavIcons
optional
default: false
Includes navigation icons, used to jump directly to a specific "slide".
###navIcon
optional
default: ".nav-icon"
CSS selector for nav icon controls.
###activeSlideClass
optional
default: "current-slide"
Class used on the current nav-icon, indicating the current slide being viewed.
###includeParallax
optional
default: false
Includes a parallax effect (background moves according to mouse). Requires imageWidth and imageHeight to be set. The image(s) must be larger than the width and height of the element windowPane is called on.
##License
windowPane.js is released under the MIT license:
Copyright (c) 2012 Adam Krone
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.