My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
MouseoverAndMouseout  
A closer look at the mouseover and mouseout options.
Updated Mar 3, 2008 by dan.dor...@gmail.com

Introduction

A Pinwheel has two options, called mouseover and mouseout, which, it may surprise you to learn, handle what happens when the user mouses over and out of the Pinwheel's choice elements.

Details

Like Pinwheel's other event hooks, mouseover and mouseout can be either a function or an array of functions.

This this keyword, in the context of mouseover and mouseout function, refers to the Pinwheel itself, but the specific choice element being moused is passed as a parameter to each function.

Pinwheel provides some mouseover and mouseout functions out of the box (so to speak). Here they are:

Pinwheel.Mouse.Over

raise

function(choice)

Raises the choice being mouseovered above its fellows; other choices are restored to their original stacking order.

addClassName

function(choice)

Adds a specified string to the class attribute of the choice element.

What's that you say? There's no place to specify the class name? Here's how that works: instead of passing the class name to addClassName every time, you only give the class name, when you're specifying your options:

{
  // other options
  mouseover: Pinwheel.Mouse.Over.addClassName('hover')
  // other options
}

So addClassName actually returns a new function with the class name built in. Hooray for closures!

Pinwheel.Mouse.Out

removeClassName

function(choice)

Removes a specified string from the class attribute of the choice element.

Provide the class name to remove in the initial call to removeClassName when specifying Pinwheel options. See the notes for Pinwheel.Mouse.Over.addClassName for details.

Powered by Google Project Hosting