Personal tools
Views

From ProtoScript

Jump to: navigation, search

Contents

YUI:Click Behavior

Adds a click event to the current behavior or callback.

Example

$proto('img#avatar', {
  Click: {
     onClick: {
        Fade: {
           opacity: {to: 0}
        }
     }
  },
});


The protoscript above says: for an image with id avatar, fade it out when the user clicks on it.

Attributes

Name Description Default Valid Values Example
target Selected element or elements to attach a click event to. If no value supplied, uses the last targeted element. If value is supplied, use the element(s) selected by the target instead. See Element Scope Inherits parent target String value denoting an interface element. target: '#avatar'
modifier Name of modifier key that must be pressed for the event to fire No modifier set 'shift', 'alt', 'ctrl' modifier: 'shift'
delay Amount of time (in seconds) to delay before firing the onClick behavior. No delay is set. number delay: 0.5

Callbacks

Name Description
onClick The callback corresponding to the Click behavior. Fired when a mouse click happens on the target. If the modifier attribute is supplied, then the given modifier key must be pressed also.

Demo

See Click Demo