Provides a simple preview scrolling panel of items like below. All the elements and selectors are customizable so it can fit into nearly every website. The plugin also includes options to allow vertical scrolling, jump links and various other scrolling options.
Contents: Features | Installing | Examples | Configuration | Credits | License
If you haven't already you can download the script from GitHub. github.com/willrossi/jQuery-Multiple-Elements-Cycle
You need to include the jQuery library. This plugin comes bundled with jQuery 1.3.2 Minified. You also need to include the jquery.multipleelements.cycle.js or the minified version in your page.
<script type="text/javascript" src="jquery-1.5.min.js"></script>
<script type="text/javascript" src="jquery.multipleelements.cycle.js"></script>
<div class="cycleElementsContainer" id="plainDemo">
<a href="#" id="cycleElementsLeft">Scroll Left</a>
<div id="cycleElements">
<ul>
<li>#1</li>
<li>#2</li>
<li>#3</li>
<li>#4</li>
<li>#5</li>
<li>#6</li>
</ul>
</div>
<a href="#" id="cycleElementsRight">Scroll Right</a>
</div>
Once you have included the JS and the html then you need to define your own CSS styles and initialize the JS effect
/* CSS */
.cycleElementsContainer li { width: XXXX; float: left; }
/* If Vertical Scroll then define the height rather than the width and remove the float */
.cycleElementsContainer li { height: XXXX;}
/* HTML */
<script type="text/javascript">
$(document).ready(function() {
$("#plainDemo").multipleElementsCycle();
});
</script>
$(document).ready(function() {
$("#plainDemo").multipleElementsCycle();
});
$(document).ready(function() {
$("#verticalDemo").multipleElementsCycle({
vertical: true
});
});
$(document).ready(function() {
$("#fixedStartDemo").multipleElementsCycle({
container: '#cycleElementsQuickly',
prev: '#cycleElementsQuicklyLeft',
next: '#cycleElementsQuicklyRight',
speed: 1000,
start: 0,
showCount: 3
});
});
Sometimes you will want custom buttons to jump to the end or start of a cycle. You can specify the selectors in the 'jumpTo' configuration.
The plugin will work out the offset from the data-position tag on the selector using jQuery data API. The offset can be the following formats - 0 for end of the page, negative values for offset on the right side or positive values for left offset.
$(document).ready(function() {
$("#jumpToDemo").multipleElementsCycle({
container: '#cycleToPointElements',
prev: '#cycleToPointPrev',
next: '#cycleToPointNext',
jumpTo: '.cycleToPoint'
})
});
To scroll through more than 1 item at a time you can pass scrollCount as an integer
and it will scroll that amount rather than 1.
If there is not enough items in the list to scroll another time it automatically scrolls the remainder
$(document).ready(function() {
$("#scrollCount").multipleElementsCycle({
container: '#cycleScrollCount',
prev: '#cycleScrollCountPrev',
next: '#cycleScrollCountNext',
scrollCount: 4
});
});
$("#demo").multipleElementsCycle({
container: '#cycle', // Selector for element (ul) container (selector)
prev: '#cycle-prev', // Selector to scroll previous (selector)
next: '#cycle-next', // Selector to scroll next (selector)
speed: 500, // Speed to scroll elements (int)
containerSize: false, // Override default size (int, px)
show: 4, // Items to show from the list (int)
start: false, // Override the start with a defined value (int)
jumpTo: false, // Selectors to use as jump list (selector)
vertical: false, // Whether Scroll is for vertical (bool)
scrollCount: 1, // How many elements to scroll when clicking next / prev (int)
element: "li", // Element which is cycled. Update this and parent (selector)
parent: "ul" // Parent element which contains the elements (selector)
});
Copyright (c) 2011 Will Rossiter (willrossi.com). If you would like to contact me you can do so through my website. Suggestions, patches or enhancements to the code are more then welcome to be emailed through to me or submitted through github.com/willrossi/jquery-multiple-elements-cycle.
Copyright (c) 2011, Will Rossiter
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Will Rossiter nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY WILL ROSSITER ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL WILL ROSSITER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.