Giter VIP home page Giter VIP logo

roundabout's Introduction

Roundabout

Note: Roundabout is no longer under active development. I've moved the documentation over here to support the exists plugin, but there are known issues and such that won't be fixed. Use at your own risk.

Roundabout is a jQuery plugin that easily converts unordered lists & other nested HTML structures into entertaining, interactive, turntable-like areas.

It’s ready-to-go straight out of the box, but if you want to get crazy, Roundabout is highly-customizable with an extensive API that allows for some pretty amazing results.

Roundabout requires jQuery (at least version 1.2).

Add-Ons

Roundabout is equipped to play nicely with a couple of other plugins if they’re made available.

  • Roundabout Shapes by Fred LeBlanc Roundabout can move in more ways than just a turntable. With Shapes, you have many other ways you can move your content around the page.

  • jQuery Easing by George McGinley Smith jQuery comes with two easing styles built in, but this plugin adds many, many more. Include this script and use any of its defined easing functions in your Roundabout animations.

  • Event.drag & Event.drop by ThreeDubMedia In addition to rotating on click, Roundabout can also move by clicking and dragging on the Roundabout element itself. Include these scripts and turn on enableDrag.

But That’s Not All!

The list above is only a list of the plugins that have support baked in, but Roundabout will play nicely with many other plugins. (It’s up to you to integrate those yourself.)

Using Roundabout

Include the jquery.roundabout.js JavaScript file on your page after you include jQuery itself. Also, either link to the included CSS file, or copy the CSS styles from that file and paste them into your site's CSS file.

To activate Roundabout in its simplest form, you can do this:

$('ul').roundabout();

Of course, this will change all of your ul elements into Roundabouts, which probably isn't what you want, but you can easily change the selector to only target the elements you wish to convert

Setting Options

You can set options on Roundabout to change how it behaves. Do this by passing in an object of options into the main Roundabout call upon initialization, like so:

$('ul').roundabout({
    btnNext: ".next"
});

Incorporating Roundabout Shapes

If you're using the sister plugin Roundabout Shapes, be sure to include the jquery.roundabout-shapes.js file after you include the main Roundabout JavaScript file. Next, you'll select the shape as on of the options that you pass into Roundabout upon initialization:

$('ul').roundabout({
    btnNext: ".next",
    shape: "figure8"
});

Calling Roundabout Methods

Roundabout comes with a number of methods you can call to better control how it works. Calling those methods are done by re-calling roundabout on the element that Roundabout is already working on and passing in the name of the method to use as the first parameter. If the method requires other parameters, pass those in as subsequent parameters.

For example, instead of using the btnNext option, you can manually implement this yourself like this:

$('.btnNext', function(e) {
    e.stopPropagation();
    e.preventDefault();
    
    // this is the action
    $('ul#myRoundabout').roundabout('animateToNextChild');
    
    return false;
});

Enabling Drag & Drop

Lately it seems that this doesn't work as well as it once did. Not sure why, but you can still enable it. To do this, you'll need to grab v2 of the jquery.event.drag and jquery.event.drop plugins by ThreeDubMedia. Include them on your page after Roundabout is included.

Next, enable your Roundabout to use drag and drop like so:

$('ul').roundabout({
    enableDrag: true
});

Using Autoplay

Autoplay lets you have Roundabout automatically animate on an interval. This functionality is included with the Roundabout core, so no additional scripts are needed to get this working.

To enable autoplay, there are three options you can set:

$('ul').roundabout({
    autoplay: true,
    autoplayDuration: 5000,
    autoplayPauseOnHover: true
});

The first option, autoplay will turn on autoplay. The second, autoplayDuration is the length of time in milliseconds between animation triggers. The final option, autoplayPauseOnHover will force autoplay never to figure while the user has their cursor over the Roundabout itself.

Support

Version 2 (the current version) works reasonably well, although if you look in the issues you'll see a number of things that don't work for some people. As mentioned above, this plugin is no longer under active development. Feel free to continue submitting issues for others to see, but no further official action can be guaranteed at all.

API

Settable Options

Roundabout comes with many settable configuration options that let you customize how it operates.

	<tr id="tilt">
		<td class="option"><code>tilt</code></td>
		<td>
			Slightly alters the calculations of moving elements.
			In the default <code>shape</code>,
			it adjusts the apparent <code>tilt</code>. Other shapes
			will differ.
		</td>
		<td class="data-type">float</td>
		<td class="default-value"><code>0.0</code></td>
	</tr>

	<tr id="minZ">
		<td class="option"><code>minZ</code></td>
		<td>
			The lowest z-index that will be assigned to a moving
			element. This occurs when the moving element is
			opposite of (that is, 180° away from) the 
			<code>focusBearing</code>.
		</td>
		<td class="data-type">integer</td>
		<td class="default-value"><code>100</code></td>
	</tr>

	<tr id="maxZ">
		<td class="option"><code>maxZ</code></td>
		<td>
			The greatest z-index that will be assigned to a
			moving element. This occurs when the moving element
			is at the same bearing as the 
			<code>focusBearing</code>.
		</td>
		<td class="data-type">integer</td>
		<td class="default-value"><code>280</code></td>
	</tr>

	<tr id="minOpacity">
		<td class="option"><code>minOpacity</code></td>
		<td>
			The lowest opacity that will be assigned to a moving
			element. This occurs when the moving element is
			opposite of (that is, 180° away
			from) the <code>focusBearing</code>.
		</td>
		<td class="data-type">float</td>
		<td class="default-value"><code>0.4</code></td>
	</tr>

	<tr id="maxOpacity">
		<td class="option"><code>maxOpacity</code></td>
		<td>
			The greatest opacity that will be assigned to a
			moving element. This occurs when the moving element
			is at the same bearing as the
			<code>focusBearing</code>.
		</td>
		<td class="data-type">float</td>
		<td class="default-value"><code>1.0</code></td>
	</tr>

	<tr id="minScale">
		<td class="option"><code>minScale</code></td>
		<td>
			The lowest size (relative to its starting size) that
			will be assigned to a moving element. This occurs
			when the moving element is opposite of (that is, 180°
			away from) the
			<code>focusBearing</code>.
		</td>
		<td class="data-type">float</td>
		<td class="default-value"><code>0.4</code></td>
	</tr>

	<tr id="maxScale">
		<td class="option"><code>maxScale</code></td>
		<td>
			The greatest size (relative to its starting size)
			that will be assigned to a moving element. This
			occurs when the moving element is at the same bearing
			as the
			<code>focusBearing</code>.
		</td>
		<td class="data-type">float</td>
		<td class="default-value"><code>1.0</code></td>
	</tr>

	<tr id="duration">
		<td class="option"><code>duration</code></td>
		<td>
			The length of time Roundabout will take to move from
			one child element being in focus to another (when an
			animation is triggered). This value acts as the
			default for Roundabout, but each animation action can
			be given a custom duration for that animation.
		</td>
		<td class="data-type">integer</td>
		<td class="default-value"><code>600</code></td>
	</tr>

	<tr id="btnNext">
		<td class="option"><code>btnNext</code></td>
		<td>
			A jQuery selector of page elements that, when
			clicked, will trigger the Roundabout to animate to
			the next moving element.
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>null</code></td>
	</tr>

	<tr id="btnNextCallback">
		<td class="option"><code>btnNextCallback</code></td>
		<td>
			A function that will be called once the animation
			triggered by a
			<code>btnNext</code>-related 
			click has finished.
		</td>
		<td class="data-type">function</td>
		<td class="default-value"><code>function() {}</code></td>
	</tr>

	<tr id="btnPrev">
		<td class="option"><code>btnPrev</code></td>
		<td>
			A jQuery selector of page elements that, when
			clicked, will trigger the Roundabout to animate to
			the previous moving element.
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>null</code></td>
	</tr>

	<tr id="btnPrevCallback">
		<td class="option"><code>btnPrevCallback</code></td>
		<td>
			A function that will be called once the animation
			triggered by a
			<code>btnPrev</code>-releated 
			click has finished.
		</td>
		<td class="data-type">function</td>
		<td class="default-value"><code>function() {}</code></td>
	</tr>

	<tr id="btnToggleAutoplay">
		<td class="option"><code>btnToggleAutoplay</code></td>
		<td>
			A jQuery selector of page elements that, when
			clicked, will toggle the Roundabout’s <a
			href="#autoplay"><code>autoplay</code></a> state
			(either starting or stopping).
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>null</code></td>
	</tr>

	<tr id="btnStartAutoplay">
		<td class="option"><code>btnStartAutoplay</code></td>
		<td>
			A jQuery selector of page elements that, when
			clicked, will start the Roundabout’s 
			<code>autoplay</code> feature
			(if it’s currently stopped).
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>null</code></td>
	</tr>

	<tr id="btnStopAutoplay">
		<td class="option"><code>btnStopAutoplay</code></td>
		<td>
			A jQuery selector of page elements that, when
			clicked, will stop the Roundabout’s
			<code>autoplay</code>
			feature (if it’s current playing).
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>null</code></td>
	</tr>

	<tr id="easing">
		<td class="option"><code>easing</code></td>
		<td>
			The easing function to use when animating Roundabout.
			With no other plugins, the standard jQuery easing
			functions are available. When using the 
			jQuery easing plugin, 
			all of its easing functions will also be available.
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>"swing"</code></td>
	</tr>

	<tr id="clickToFocus">
		<td class="option"><code>clickToFocus</code></td>
		<td>
			When <code>true</code>, Roundabout will bring
			non-focused moving elements into focus when they’re
			clicked. Otherwise, click events won’t be captured
			and will be passed through to the moving child
			elements.
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>true</code></td>
	</tr>

	<tr id="clickToFocusCallback">
		<td class="option"><code>clickToFocusCallback</code></td>
		<td>
			A function that will be called once the 
			<code>clickToFocus</code> 
			animation has completed.
		</td>
		<td class="data-type">function</td>
		<td class="default-value"><code>function() {}</code></td>
	</tr>

	<tr id="focusBearing">
		<td class="option"><code>focusBearing</code></td>
		<td>
			The bearing that Roundabout will use as the focus
			point. All animations that move Roundabout between
			children will animate the given child element to this
			bearing.
		</td>
		<td class="data-type">float</td>
		<td class="default-value"><code>0.0</code></td>
	</tr>

	<tr id="shape">
		<td class="option"><code>shape</code></td>
		<td>
			The path that moving elements follow. By default,
			Roundabout comes with one shape, which is
			<code>lazySusan</code>. When using Roundabout with the
			Roundabout Shapes
			plugin, there are many other shapes available.
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>"lazySusan"</code></td>
	</tr>

	<tr id="debug">
		<td class="option"><code>debug</code></td>
		<td>
			When <code>true</code>, Roundabout will replace the
			contents of moving elements with information about
			the moving elements themselves.
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>false</code></td>
	</tr>

	<tr id="childSelector">
		<td class="option"><code>childSelector</code></td>
		<td>
			A jQuery selector of child elements within the elements Roundabout
			is called upon that will become the moving elements within
			Roundabout. By default, Roundabout works on unordered lists, but it
			can be changed to work with any nested set of child elements.
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>"li"</code></td>
	</tr>

	<tr id="startingChild">
		<td class="option"><code>startingChild</code></td>
		<td>
			The child element that will start at the Roundabout’s 
			<code>focusBearing</code>
			on load. This is a zero-based counter based on the
			order of markup.
		</td>
		<td class="data-type">integer</td>
		<td class="default-value"><code>0</code></td>
	</tr>

	<tr id="reflect">
		<td class="option"><code>reflect</code></td>
		<td>
			When <code>true</code>, reverses the direction in which
			Roundabout will operate. By default, <em>next</em>
			animations will rotate moving elements in a clockwise
			direction and <em>previous</em> animations will be
			counterclockwise. Using reflect will flip the two.
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>false</code></td>
	</tr>

	<tr id="floatComparisonThreshold">
		<td class="option"><code>floatComparisonThreshold</code></td>
		<td>
			The maximum distance two values can be from one
			another to still be considered equal by Roundabout’s
			standards. This prevents JavaScript rounding errors.
		</td>
		<td class="data-type">float</td>
		<td class="default-value"><code>0.001</code></td>
	</tr>

	<tr id="autoplay">
		<td class="option"><code>autoplay</code></td>
		<td>
			When true, Roundabout will automatically advance the
			moving elements to the next child at a regular
			interval (settable as
			<code>autoplayDuration</code>).
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>false</code></td>
	</tr>

	<tr id="autoplayInitialDelay">
		<td class="option"><code>autoplayInitialDelay</code><small>added in v2.4</small></td>
		<td>
			The length of time (in milliseconds) to delay the start of 
			Roundabout’s configured <code>autoplay</code>
			option. This only works with setting <code>autoplay</code> to
			<code>true</code>, and only on the first start of <code>autoplay</code>.
		</td>
		<td class="data-type">integer</td>
		<td class="default-value"><code>0</code></td>
	</tr>

	<tr id="autoplayDuration">
		<td class="option"><code>autoplayDuration</code></td>
		<td>
			The length of time (in milliseconds) between
			animation triggers when a
			Roundabout’s <code>autoplay</code>
			is playing.
		</td>
		<td class="data-type">integer</td>
		<td class="default-value"><code>1000</code></td>
	</tr>

	<tr id="autoplayPauseOnHover">
		<td class="option"><code>autoplayPauseOnHover</code></td>
		<td>
			When <code>true</code>, Roundabout will pause 
			<code>autoplay</code> when the
			user moves the cursor over the Roundabout container.
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>false</code></td>
	</tr>

	<tr id="enableDrag">
		<td class="option"><code>enableDrag</code></td>
		<td>
			Requires event.drag 
			and 
			event.drop
			plugins by 
			ThreeDubMedia. 
			Allows a user to rotate Roundabout be clicking and
			dragging the Roundabout area itself.
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>false</code></td>
	</tr>

	<tr id="dropDuration">
		<td class="option"><code>dropDuration</code></td>
		<td>
			The length of time (in milliseconds) the animation
			will take to animate Roundabout to the appropriate
			child when the Roundabout is “dropped.”
		</td>
		<td class="data-type">integer</td>
		<td class="default-value"><code>600</code></td>
	</tr>

	<tr id="dropEasing">
		<td class="option"><code>dropEasing</code></td>
		<td>
			The easing function to use when animating Roundabout
			after it has been “dropped.” With no other plugins, 
			the standard jQuery easing functions are available. 
			When using the 
			jQuery easing plugin
			all of its easing functions will also be available.
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>"swing"</code></td>
	</tr>

	<tr id="dropAnimateTo">
		<td class="option"><code>dropAnimateTo</code></td>
		<td>
			The animation method to use when a dragged Roundabout
			is “dropped.” Valid values are <em>next</em>,
			<em>previous</em>, or <em>nearest</em>.
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>"nearest"</code></td>
	</tr>

	<tr id="dropCallback">
		<td class="option"><code>dropCallback</code></td>
		<td>
			A function that will be called once the dropped
			animation has completed.
		</td>
		<td class="data-type">function</td>
		<td class="default-value"><code>function() {}</code></td>
	</tr>

	<tr id="dragAxis">
		<td class="option"><code>dragAxis</code></td>
		<td>
			The axis along which drag events are measured. Valid
			values are <em>x</em> and <em>y</em>.
		</td>
		<td class="data-type">string</td>
		<td class="default-value"><code>"x"</code></td>
	</tr>

	<tr id="dragFactor">
		<td class="option"><code>dragFactor</code></td>
		<td>
			Alters the rate at which dragging moves the
			Roundabout’s moving elements. Higher numbers will
			cause the moving elements to move less.
		</td>
		<td class="data-type">integer</td>
		<td class="default-value"><code>4</code></td>
	</tr>

	<tr id="triggerFocusEvents">
		<td class="option"><code>triggerFocusEvents</code></td>
		<td>
			When <code>true</code>, a <code>focus</code> event will
			be triggered on the child element that moves into
			focus when it does so.
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>true</code></td>
	</tr>

	<tr id="triggerBlurEvents">
		<td class="option"><code>triggerBlurEvents</code></td>
		<td>
			When <code>true</code>, a <code>blur</code> event will be
			triggered on the child element that moves out of the
			focused position when it does so.
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>true</code></td>
	</tr>

	<tr id="responsive">
		<td class="option"><code>responsive</code><small>added in v2.1</small></td>
		<td>
			When <code>true</code>, attaches a resize event onto the 
			window and will automatically relayout Roundabout’s
			child elements as the holder element changes size.
		</td>
		<td class="data-type">boolean</td>
		<td class="default-value"><code>false</code></td>
	</tr>
</tbody>
Option Description Data Type Default
bearing The starting direction in which Roundabout should face relative to the focusBearing. float 0.0

Callable Methods

Roundabout does a lot on its own, but all of the methods it uses internally to perform actions are publicly usable as well. Manually calling these methods give even more control over how Roundabout functions.


roundabout

Starts the Roundabout.

Usage
.roundabout()
.roundabout(options)
.roundabout(callback)
.roundabout(options, callback)
Parameters
object options is an object of options to configure how Roundabout acts
function callback is a function that is called once the Roundabout is ready

Returns a jQuery object.


setBearing

Changes the bearing of the Roundabout.

Usage
.roundabout("setBearing", bearing)
.roundabout("setBearing", bearing, callback)
Parameters
float bearing is a value between 0.0 and 359.9
function callback is a function that is called once the change completes

Returns a jQuery object.


adjustBearing

Alters the bearing of the Roundabout by a given amount, either positive or negative degrees.

Usage
.roundabout("adjustBearing", delta)
.roundabout("adjustBearing", delta, callback)
Parameters
float delta is the amount by which the bearing will change (either positive or negative)
function callback is a function that is called once the change completes

Returns a jQuery object.


setTilt

Changes the tilt of the Roundabout.

Usage
.roundabout("setTilt", tilt)
.roundabout("setTilt", tilt, callback)
Parameters
tilt tilt is a value typically between -2.0 and 10.0
function callback is a function that is called once the change completes

Returns a jQuery object.


adjustTilt

Alters the tilt of the Roundabout by a given amount, either in positive or negative mounts.

Usage
.roundabout("adjustTilt", delta)
.roundabout("adjustTilt", delta, callback)
Parameters
tilt delta is the amount by which the tilt will change (either positive or negative)
function callback is a function that is called once the change completes

Returns a jQuery object.


animateToNearestChild

Animates the Roundabout to the nearest child. This animation will not move the Roundabout if any child is already in focus.

Usage
.roundabout("animateToNearestChild")
.roundabout("animateToNearestChild", callback)
.roundabout("animateToNearestChild", duration, easing, callback)
Parameters
integer duration is the length of time (in milliseconds) that the animation will take to complete; uses Roundabout’s configured duration if no value is set here
string easing is the name of the easing function to use for movement; uses Roundabout’s configured easing if no value is set here
function callback is a function that is called once the change completes

Returns a jQuery object.


animateToChild

Animates the Roundabout to the given childPosition, which is a zero-based counter of children based on the order of markup.

Usage
.roundabout("animateToChild", childPosition)
.roundabout("animateToChild", childPosition, callback)
.roundabout("animateToChild", childPosition, duration, easing)
.roundabout("animateToChild", childPosition, duration, easing, callback)
Parameters
integer childPosition is the zero-based child to which Roundabout will animate
integer duration is the length of time (in milliseconds) that the animation will take to complete; uses Roundabout’s configured duration if no value is set here
string easing is the name of the easing function to use for movement; uses Roundabout’s configured easing if no value is set here
function callback is a function that is called once the change completes

Returns a jQuery object.


animateToNextChild

Animates the Roundabout to the next child element.

Usage
.roundabout("animateToNextChild")
.roundabout("animateToNextChild", callback)
.roundabout("animateToNextChild", duration, easing)
.roundabout("animateToNextChild", duration, easing, callback)
Parameters
integer duration is the length of time (in milliseconds) that the animation will take to complete; uses Roundabout’s configured duration if no value is set here
string easing is the name of the easing function to use for movement; uses Roundabout’s configured easing if no value is set here
function callback is a function that is called once the change completes

Returns a jQuery object. Returns a jQuery object.


animateToPreviousChild

Animates the Roundabout to the previous child element.

Usage
.roundabout("animateToPreviousChild")
.roundabout("animateToPreviousChild", callback)
.roundabout("animateToPreviousChild", duration, easing)
.roundabout("animateToPreviousChild", duration, easing, callback)
Parameters
integer duration is the length of time (in milliseconds) that the animation will take to complete; uses Roundabout’s configured duration if no value is set here
string easing is the name of the easing function to use for movement; uses Roundabout’s configured easing if no value is set here
function callback is a function that is called once the change completes

Returns a jQuery object.


animateToDelta

Animates the Roundabout to the given amount of degrees away from its current bearing (either positive or negative degrees).

Usage
.roundabout("animateToDelta", degrees)
.roundabout("animateToDelta", degrees, callback)
.roundabout("animateToDelta", degrees, duration, easing)
.roundabout("animateToDelta", degrees, duration, easing, callback)
Parameters
float degrees is the amount by which the bearing will change (either positive or negative)
integer duration is the length of time (in milliseconds) that the animation will take to complete; uses Roundabout’s configured duration if no value is set here
string easing is the name of the easing function to use for movement; uses Roundabout’s configured easing if no value is set here
function callback is a function that is called once the change completes

Returns a jQuery object.


animateBearingToFocus

Animates the Roundabout so that a given bearing ends at the configured focusBearing.

Usage
.roundabout("animateBearingToFocus", degrees)
.roundabout("animateBearingToFocus", degrees, callback)
.roundabout("animateBearingToFocus", degrees, duration, easing)
.roundabout("animateBearingToFocus", degrees, duration, easing, callback)
Parameters
float degrees is a value between 0.0 and 359.9
integer duration is the length of time (in milliseconds) that the animation will take to complete; uses Roundabout’s configured duration if no value is set here
string easing is the name of the easing function to use for movement; uses Roundabout’s configured easing if no value is set here
function callback is a function that is called once the change completes

Returns a jQuery object.


startAutoplay

Starts the Roundabout’s autoplay feature.

Usage
.roundabout("startAutoplay")
.roundabout("startAutoplay", callback)
Parameters
function callback is a function that is called after each autoplay animation completes

Returns a jQuery object.


stopAutoplay

Stops the Roundabout’s autoplay feature.

Usage
.roundabout("stopAutoplay")
.roundabout("stopAutoplay", keepAutoplayBindings)
Parameters
boolean keepAutoplayBindings — when true — will not destroy any autoplay mouseenter and mouseleave event bindings that were set by autoplayPauseOnHover

Returns a jQuery object.


toggleAutoplay

Starts or stops the Roundabout’s autoplay feature (based upon its current state).

Usage
.roundabout("toggleAutoplay")
.roundabout("toggleAutoplay", callback)
Parameters
function callback is a function that is called after each autoplay animation completes

Returns a jQuery object.


isAutoplaying

Checks to see if the Roundabout’s autoplay feature is currently playing or not.

Usage
.roundabout("isAutoplaying")
Parameters

No parameters.

Returns a boolean.


changeAutoplayDuration

Changes the length of time (in milliseconds) that the Roundabout’s autoplay feature waits between attempts to animate to the next child.

Usage
.roundabout("changeAutoplayDuration", duration)
Parameters
integer duration is a length of time (in milliseconds) between attempts to have autoplay animate to the next child element

Returns a jQuery object.


relayoutChildren

Repositions child elements based on new contextual information. This is most helpful when the Roundabout element itself changes size and moving child elements within need readjusting.

Usage
.roundabout("relayoutChildren")
Parameters

No parameters.

Returns a jQuery object.


getNearestChild

Gets the nearest child element to the focusBearing. This number is a zero-based counter based on order of markup.

Usage
.roundabout("getNearestChild")
Parameters

No parameters.

Returns a integer.


getChildInFocus

Gets the child currently in focus. This number is a zero-based counter based on order of markup.

Usage
.roundabout("getChildInFocus")
Parameters

No parameters.

Returns a integer.

Hookable Events

Roundabout is equipped to trigger events on both the Roundabout element itself and the moving child elements.

ready

This event fires on the Roundabout element once it and its child elements have been initialized. It also fires on each child element once it has been initialized.

focus

This event fires on child elements that land in the focusBearing at the end of an animation. Will only fire if triggerFocusEvents is set to true.

blur

This event fires on child elements that move away from the focusBearing at the start of an animation. Will only fire if triggerBlurEvents is set to true.

childrenUpdated

This event fires on the Roundabout element when its child elements have been repositioned and are in place.

reposition

This event fires on child elements that have been repositioned and are in place.

bearingSet

This event fires on the Roundabout element when its bearing has been set.

moveClockwiseThroughBack

This event fires on moving child elements when an animation causes them pass through the point that is opposite (or 180°) from the focusBearing in a clockwise motion.

moveCounterclockwiseThroughBack

This event fires on moving child elements when an animation causes them to pass through the point that is opposite (or 180°) from the focusBearing in a counterclockwise motion.

animationStart

This event fires on the Roundabout element at the start of any animation.

animationEnd

This event fires on the Roundabout element at the end of any animation.

autoplayStart

This event fires on the Roundabout element when the autoplay feature starts.

autoplayStop

This event fires on the Roundabout element when the autoplay feature stops.

roundabout's People

Contributors

fredleblanc avatar vantanev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roundabout's Issues

Mousewheel Support / getChildInFocus

Hi,

at the moment I using the mousewheel plugin from brandon aaron.
it is not as smooth as the drag drop extension but with the duration set to low values every fired event will be processed, yay.

the problem is that sometimes getChildInFocus returns false.
usually when the (bearing?) current position is 180° or 0°

can you give me a hint what im doing wrong?

best regards,
simon

the code i use

$('.coverflow').bind('mousewheel',function(e,delta,deltaX,deltaY){

                var cPos, nextPos;

                e.preventDefault();
                e.stopPropagation();

                cPos = $('.coverflow').roundabout("getChildInFocus");
                nextPos = cPos+delta;

                if(nextPos > 15 ) nextPos = nextPos-16;
                if(nextPos <  0 ) nextPos = nextPos+16;

                console.log("d:"+delta+" nextPos:"+nextPos+" cPos:"+cPos +" childCount:" +childCount);
                console.log(delta, deltaX, deltaY);

                $('.coverflow').roundabout("animateToChild", nextPos, 33);
            });

how i setup

$('.coverflow').roundabout({
                childSelector: ".coverflow_element",
                startingChild: <%=startingCover%>,
                autoplay: true,
                autoplayInitialDelay: 2500,
                autoplayDuration: 2500,
                autoplayPauseOnHover: true,
                enableDrag: true,
                dropEasing: "swing",
                responsive: false,
                clickToFocus: true,
                tilt: 0.0,
                minOpacity: 0.1,
                maxOpacity: 1.0,
                minScale: 0.1,
                maxScale: 1.0,
                shape: 'squareshrink',
                triggerFocusEvents: true

            })

there are 16 elements in the flow.

Mousewheel Examples:
http://flowplayer.org/tools/toolbox/mousewheel.html
https://github.com/brandonaaron/jquery-mousewheel

clock demo and 2.4 version trouble

Hi there,

As I was trying to reproduce your brillant clock demo with latest bundle version, I figured out that the cycling number magic does not work with 2.4 version (all li items cycles), but final number is correct.

Disconnect between the visible scroll and the memory of it

There is a disconnect between the scroll and the memory the roundabout has of it.

Say I scroll a bit from the far right hand side, and then point to this same far right hand side and click, when I barely start to drag then the roundabout is doing a sort of reset, to the position it has in its own memory.

This happens on my Firefox 10.0.2 on Linux Mint 12 and on Chrome 17.0.963.56 (Developer Build 121963 Linux) Built on Ubuntu 11.10, running on LinuxMint 12 but does NOT happen on my iPod Touch os 4.3.5.

Different dimensions for active item

I think it would be great if we could change the dimensions for the active item - .roundabout-in-focus. I tried doing this in CSS, but since the styles are inline this does not apply.

It could be an option, maybe? The use case I'm thinking of is one in which I have several items, but I want to display more content on the active one. Maybe an image shows in the inactive ones, and I show the image and a descriptive paragraph or two with the active one.

How to fix keyboard accessibility issues

Hello,

I'd like to fix a few issues that are related with keyboard browsing on my roundabout :

  1. When you're browsing via keyboard, the focus goes to the first <li> child, even if it's not currently visible.
  2. Furthermore, my roundabout is configured to autoscroll. Then it should stop if any of its child element has the focus.
  3. If you keep tabbing from the first child element, it should give the focus to the next one AND move to it.
  4. Finally, when all the childs have been focused, the focus should go out of the roundabout (to the next <a> element).

So I've tried the following code :

$(document).ready(function() {
    var interval;
    $('#roundabout-jeunesse ul')
        .roundabout({ duration: 1000 })
        .hover(function() { clearInterval(interval); }, function() { interval = startAutoPlay(); });
    interval = startAutoPlay();

    /// Give the focus to the first VISIBLE child !!!
    $("#roundabout-jeunesse").find("a").first().focusin(function() {
        $(this).parents("ul").find("li.roundabout-in-focus a").focus();
        return false;
    });

    /// If any of the child element has the focus, stop the autoplay ; then restart it if the roundabout loses the focus
    $("#roundabout-jeunesse")
        .focus(function() { clearInterval(interval); })
        .focusout(function() { interval = startAutoPlay(); });

    /// When tabbing, the roundabout has to move to the next <li> element
    $("#roundabout-jeunesse").find("a").bind("keydown", function(e) {
        var code = (e.keyCode ? e.keyCode : e.which);
        if (code == 9) { $('#roundabout-jeunesse ul').roundabout("animateToNextChild"); }
    });
});
function startAutoPlay() {
    return setInterval(function() { $('#roundabout-jeunesse ul').roundabout('animateToNextChild'); }, 3000);
}

First of all, I'm using the last version of roundabout, available here on GitHub. So I'm not sure if my AutoPlay code is the best one (at least it seems to work).
With the previous code, the point number 1 is indeed fixed.
But numbers 2, 3 and 4 simply don't work : the autoplay doesn't stop when tabbing through the roundabout, and the focus goes out of the roundabout before all the <li> child elements have been focused.

What am I doing wrong ? Any help on this would be greatly appreciated.

Thanx very much in advance !
Best regards,
Dupond

Blur / Opacity Problem in IE 9

Hey Guys, Blur and Opacity doesnt work in IE 9. Here is how i use the widget. Maybe you see the problem:

$(document).ready(function(){
(function($) {

var duration = 600;

$('.quote-widget ul')
    .on('ready', function() {
        $('.quote-widget').addClass('ready');

        if (Modernizr.textshadow) {
            $(this).find('li').not( $(this).find('li').first() ).css('color', 'rgba(255, 255, 255, .01)');
        } else {
            $(this).find('li').not( $(this).find('li').first() ).find('blockquote').css('opacity', 0.2);
        }
    })
    .roundabout({
        shape: 'rollerCoaster',
        minOpacity: 0.3,
        minScale: 0.5,
        duration: duration,
        btnNext: '.quote-widget .next',
        btnPrev: '.quote-widget .prev',
        clickToFocus: false,
        triggerFocusEvents: true,
        triggerBlurEvents: true,
        autoplay: true,
        autoplayDuration: 5000,
        autoplayPauseOnHover: true
    })
;

$('.quote-widget li')
    .on('focus', function() {
        //$(this).animate({color: 'rgba(255, 255, 255, 1)'}, duration);
        if (!Modernizr.textshadow) {
            $(this).find('blockquote').animate({opacity: 1}, duration / 2);
        }
    })
    .on('blur', function() {
        if (Modernizr.textshadow) {
            $(this).animate({color: 'rgba(255, 255, 255, 0.01)'}, duration);
        } else {
            $(this).find('blockquote').animate({opacity: 0.2}, duration);
        }
    })
;

}(jQuery));

    });

A roundabout of infinite diameter

It'd be nice to have an infinite diameter to the roundabout, or even better, a diameter that could be scaled, so as to have a wheel that looks like a scrolling banner, or almost. This way, some of the items would be out of the view, and not playing hide and seek from behind.

jQuery UI support

Hi,
Have you considered whether it would make sense to support jQuery UI as addon instead of the three seperate already compatible addons?
The easing library as well as drag and drop support have been incorporated some time ago.

Thanks for this nice plugin!

Callbacks "animationStart" and "animationEnd" don't work (Jquery 1.7.2)

The callbaks for the "animationStart" and "animationEnd" events don't work properly after each "turn" animation.

I'm trying both ways:

declaring the function right in the callback property:

ex:

$('seletor').roundabout({
    animationStart:function (){
          //do something
   }
});

and declaring the function name to call it, ex:

$('seletor').roundabout({
    animationStart: function_to_be_called()
});

Handling only two items

If i have only two items in the script, one stays in front of the other and the one on the back cant be seen or touched, it seems that only one exists, how can i improve this? Thank you

scale images

at first: excuse my bad english .....

the problem: All the funny things with "roundabout" will working fine, but it would be better if the images in a moveable will be scaled when the moveable is not in focus.

Grayscale (inactive)

Is it possible to setup grayscale option (along with opacity) for the inactive items?

Bad CSS. Would need a better example.

Hello,

On my blog I've set a roundabout carousel. It works, but the CSS code is far to be perfect.

For the moment, I use the following code :

.roundabout-holder { width: 700px; height: 25em; margin: 1em auto; }
    .ISIE67 .roundabout-holder { overflow: hidden; }
.roundabout-moveable-item { list-style: none; width: 20em; height: 20em; margin: 0; cursor: pointer; text-align: center; }
    .roundabout-moveable-item img { height: 100%; margin: 0 !important; }
    #page .roundabout-holder img { border: 0; padding: 0; }
.roundabout-in-focus { cursor: auto; }

The troubles are :

  1. The images are distorted when their size is reduced.
  2. The images are not centered as they should : in the back we can see that the image is on the right compared to the one at the front.
  3. The width of the carousel is not the same in Firefox and IE. And whereas it's set at 700px; it seems to be a bit more (like 720 or 740px).
  4. Is there a way to know exactly the height of the carousel ? I would need to set the height of my container at 20px at the top PLUS 20px at the bottom PLUS the height of the carousel.
  5. Even though the width of the images is set in the HTML code, the CSS width is wider than the width of the image itself, so you can't click on the image at the back because of the width of the image at the front (not sure this is understandable at all ;))

Thanx very much for your help !
Best regards,
Dupond

jQuery 1.7.2 support

I was using the latest version of jQuery and when I clicked an element in the carousel it would loop completely around every time (rotating n+1 times where n is the number of elements in the carousel). Similar for auto rotate. I switched down to jQuery 1.4.4 and received expected click behavior (switches to the item clicked). I tested in both FF3.6 on OS 10.5 and also on Opera 11.62 on Windows 7.

Linear easing not working

It appears the linear easing option is not working as it is supposted to do, since there is no smooth animation at all. The roundabout just instantly 'jumps' to the next list item. When I switch back to 'swing', it is working once again.


<script type="text/javascript"> $(document).ready(function() { $('#carouselContainer ul').roundabout(); interval = startAutoPlay(); function startAutoPlay() { return setInterval(function() { $('#carouselContainer ul').roundabout_animateToPreviousChild(1995, 'linear'); }, 2000); } }); </script>

with jQueryUI animation broken

Hi,

i´m allready using jQuery UI in my Project and i wondered why roundabout animations are not correctly.
There is a wild animation :-)

I identified the problem to jQueryUI, only when i have remove jQueryUI from my Project roundabout animates correct.

Without the Effects modules it will working correctly.

Is there a solution?

Thanx Martin

Not positioning correctly

I can't get roundabout to the proper position on my web page. I've tried just about every css rule that I can think of. It won't center in my roundabout holder or the div I've put it in. Plus, in Safari and Chrome, I can't get the footer to clear it. I desperately need help with this.

Issue with minScale and maxScale

I haven't confirmed yet but I believe the issue exists with minOpacity, maxOpacity, minZ, and maxZ as well.

Javascript error in Firefox 8.0 is as follows:
(info.scale.min + info.scale.diff * factors.scale).toFixed is not a function on line 1088

I fixed this by using the parseFloat function.
factors.adjustedScale = parseFloat((info.scale.min + (info.scale.diff * factors.scale))).toFixed(4);

Thanks for getting back to me on the autoplay issue I had. Great Plugin btw!

Drag & Drop

I configured roundabout according to the tutorial http://fredhq.com/projects/roundabout#enable-drag-drop

I am using the following scripts:

jquery.js 1.4.4
jquery.roundabout.min.js 2.3
jquery.event.drag-2.0.min.js
jquery.event.drop-2.0.min.js

When clicking on a roundabout item my firebug console displays the javascript error:

a.setAttribute is not a function (jquery.js line 56)

Choppy and not fluid behaviour in IE8

Issue: In IE8 the slider on the webpage behaves choppy and not fluid as compared to IE9 and other modern
browsers.
Using roundabout version 2.1.1 and jQuery v1.7.1

removing fixed height on .roundabout-holder breaks animateToNearestChild when dragging

Any change to the class rule for .roundabout-holder which results in anything other than a fixed height -- either specified in % or auto, or removed completely -- causes the drag behavior to break (animateToNearestChild, if I'm not mistaken) in such a way that when you release the mouse on drag, the roundabout does not move any further. Clicking or dragging still works, but it does not animate to the nearest child; it just stops moving unless acted upon by some other control. I'm using the latest versions of Roundabout (2.4), event.drag (2.2), and jQuery (1.7.2). Also, the setting of responsive to true does not affect this behavior. Here are two examples, side-by-side:

This one works:
https://dl.dropbox.com/u/92134327/roundabout_08_dragworks/index.html

This one doesn't:
https://dl.dropbox.com/u/92134327/roundabout_10_dragbroken/index.html

As you will see, they are nearly identical, except for commenting out the height setting for .roundabout-holder and adjusting the margins to somewhat center the container object within the browser.

Mouswheel

Im working on a basic mousewheel support for my roundabout.

I am using:
jquery.mousewheel.js 3.0.6 http://brandonaaron.net/code/mousewheel/docs
jquery.roundabout.js 2.3

My first working example looks like this:

instance.roundabout(settings.roundabout);

instance.bind('mousewheel', function(event, delta) {
  event.preventDefault();

  if (delta > 0) {
    instance.roundabout('animateToNextChild', 1, 'linear');
  }
  else {
    instance.roundabout('animateToPreviousChild', 1, 'linear');
  }
});

Now I am trying to create a circular animation on mousewheel movements like:
http://finnrudolph.de/ImageFlow/Examples#Enable_circular_mode
http://www.professorcloud.com/mainsite/carousel.htm

I read your comment on #13 (comment) and made some attempts with animateToDelta and animateToNearestChild but nothing worked like intended.

Could you please give me an example of how to create a circular animation with easing in response to mousewheel movements.

Thanks in advance and best regards.

Opera Support is very... Jumpy

I'm sure this is a problem with Opera's rendering engine, but it's very jumpy. Doesn't bother me that much, just curious if this was a known problem or if I'm the only one with this issue.

responsive option break autoplayDuration

when set responsive option to true and autoplay to true

the slider speed up when window minimized

my code:

$(document).ready(function() {
    $('ul').roundabout({
        autoplay: true,
        autoplayDuration: 5000,
        autoplayPauseOnHover: true,
        responsive: true,
});
        });

Remote loading of items [data is undefined error]

Hi

I load the the ul list I want to create the roundabout from with a $.get and then I call .roundabout({ shape: 'square' }) ... this works the first time. As soon as I want to reload the ul list a second time with different items and call roundabout agaın ... I start getting a constant error logged as "data is undefined":

Error: data is undefined
Source File: js/jquery.roundabout.js
Line: 734

self = $(this),
data = self.data("roundabout"),
[line 734] bearing = (!data.reflect) ? data.bearing % 360 : data.bearing,

sample of what Im doing:

function loadItems() {
$.get("items.aspx?cid=" + $("#hdcid").val(), function(data) {
$("#content").html(data);
$('#main-slider ul').roundabout({ shape: 'square' });
});
}

Animation Broken in jQuery v1.7.2

Roundabout doesn't seem to animate anymore when used with jQuery v1.7.2. Need to look into this, but I'm a bit busy at the moment. Use with v1.7.1 for now.

Roundabout and Responive Web Design

Hi,

This is not really an issue, but it seems that in older versions of the plugin, the carousel adapted to the width of the container ... but now it is no longer the case.

Can we expect a return of this feature? With the emergence of "Web Design Responve" I hoped to rely on this plugin! But now I can not ...

Thank you!

Changing direction of the "dropAnimateTo" option

Hello,

I would like my roundabout to animate to the next element after dragging and dropping the carousel to the left, and animate to the previous element after dragging and dropping the carousel to the right.

Is this possible? If so, how would i go about doing it?

Use CSS Transforms for scaling

Hi Fred,

I love the roundabout plugin, but I see that in its current works it tries to scale all content one by one with basic css.

It will be much faster and give way better results if you just use CSS Transforms (when available) to achieve the animation.

Its just an idea.

Greetings,
George

Firefox problem with 3D demo

Your 3D demo don't work with Firefox 12 :
http://fredhq.com/projects/roundabout/demos/3d

You need to change this in your source :
"-moz-transform": "perspective(2000) rotateY(" + (rotateY_-1) + "deg)",
to :
"-moz-transform": "perspective(2000px) rotateY(" + (rotateY_-1) + "deg)",

It won't hurt to do the same on Webkit, but it is not necessary.

Ability to control the offset of non focused elements.

Is there a way to control how much of the non-focused elements are visible from the in-focus element? Basically I have four panels in roundabout but want only a small portion of the next/prev elements to be visible from behind the in-focus. Maybe a way to say an offset of show only 25px of the non focused blocks that would adjust the position left accordingly?

Roundabout in Chrome 19 - Not working on OS X 10.7

On my side, it's causing an aw snap from google chrome since it has been updated in v.19
I am not sure if the issue reproduces on OS X 10.6. This is unique to Chrome, works well in Safari and others.

You can have a look at my issue here http://pascalmorabito.com/jewellery-joaillerie/ (i try deactivating roundabout and it worked well making it guilty as charged but this is not what i want obviously). Chrome 19 is supposed to be shipped with a new JS engine, so not sure how it affects Roundabout.

Do you have any idea what's the issue?

Reload/Cache Problem with Images in Firefox

We love "Roundabaout", but we have following problem. You can see it at http://hochzeitsverzeichnis.agentur-mai.de. When you load the page you can see the "Roundabout-Slider". It works fine. But when you press CTRL+F5 in Firefox, the page reloads but the images a resized too small. When you press just F5, the images are resized correct.
What can we do? Is there a known solution? Thank you very much for answering.

Autoplay Hover Issue

When having roundabout stop autoplay on hover, and then firing the stopAutoplay method. All is well unless you mouseover the roundabout then the autoplay starts again. Which isn't a terrible thing. I'm sure I can write something to take care of this but I would just assume if I had stopped autoplay it would not start up again unless I restarted it. Either way I'm very pleased with this plugin.

Excessive roundabouting

In using version 2.4 copied from the github repo with minimal options, as suggested by the lessons on the website page, the roundabout rotates several times before landing on the clicked element.

I switched to version 2.1.1 which was being used by the website and the problem went away, the roundabout behaved as normal and only rotated to the clicked element.

How can I hook to event 'animationStart' ?

Hello.

Thank you for the great script! It is really awesome.

In the Hookable Events section of the API there is an animationStart event.
But I was unable to hook anything to it in any way I know (bind(), $(selector).roundabout().animationStart() or setting it as option).

What is a secret?
Thank you.

enableDrag

Hello,

I used the demo script to get my Roundabout able to drag.
But the issue is that if you drag it to a position and then drag it again it goes to the first row again.
So if you have a lot of LI's in the roundabout and enable dragging, you can never reach that.

Let me know when this is fixed.

Thanks,
Alexw

How to update roundabout dynamically

Hi,
My UL is dynamically built, as I add LI items on the fly (After Init of roundabout). When I do this , the layout is not correct in the control. How do I force a recalc of the layout when a LI is added dynamically? I tried $("#MyUL").roundabout("relayoutChildren"); but that did not have any effect.

Thanks,
Mike

[Bug] jQuery 1.7.2 with easing plugin

when using jQuery 1.7.2 with easing plugin 1.3

and the roundabout animation will be cary mess up....

please fix it, thanks a lot a lot a lot.......

Autoplay in IE

With autoplay enabled and when you scroll past the roundabout carousel on transition the page will jump up to the carousel on each slide change in IE.

Pager functionality available?

Hi!

First: Thank you for a superb and great plugin.

Is there a pager functionality available? I've looked at the whole page, but was not able to find anyone. There are of course event to pick up from. But I was wondering if there is a feature I overlooked or so?

Best,
Alonso

Center Smaller Images

Is it possible to center an image that is in focus?

So if I have a carousel that has numerous photos of different sizes, the one in focus well vertically center instead of being aligned with the tilt?

Focused item(top object) delay

Hi.
I am experiencing a tiny issue.
The problem is that top layer item always bit comes in delayed ( let's say 100ms?).

i would like to know how to fix that.

example: http://jsfiddle.net/nori2tae/f5CjK/

  • roundAbout ver. 2.1 (2.4 circular motion went crazy by the way. It is like adding 1 extra rotation when i press next/prev button)
  • jquery: 1.7.2
  • jquery easing: enabled

Dynamic adding of items

Is there anyway to add items to the roundabout dynamically without having to reload the entire roundabout? Ideally, I'd like to use the results of an AJAX request to populate a new item and have the roundabout focus on it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.