Personal tools
Views

From ProtoScript

Jump to: navigation, search

Contents

YUI:Timer Behavior

Adds a timer event to the current behavior or callback.

Example

$proto('img#avatar', {
  Timer: {
     delay: 2,
     onTimer: {
        Fade: {
           opacity: {to: 0}
        }
     }
  },
});


The protoscript above says: for an image with id avatar, fade it out after a 2 second delay.

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'
delay Amount of time (in seconds) to delay before firing the behavior. No delay is set. number delay: 0.5

Callbacks

Name Description
onTimer The callback corresponding to the Timer behavior. Fired after a specified delay. The delay attribute defines how many seconds to delay before performing nested behaviors.

Demo

See Click Demo