Skip to contents

Manipulate specified class(es) to matched elements while animating all style changes.

  • jqui_add_class(): Add class(es).

  • jqui_remove_class(): Remove class(es).

  • jqui_switch_class(): Switch class(es).

Usage

jqui_add_class(
  ui,
  className,
  duration = 400,
  easing = "swing",
  complete = NULL
)

jqui_remove_class(
  ui,
  className,
  duration = 400,
  easing = "swing",
  complete = NULL
)

jqui_switch_class(
  ui,
  removeClassName,
  addClassName,
  duration = 400,
  easing = "swing",
  complete = NULL
)

Arguments

ui

The target ui element(s) to be manipulated. Can be

className

One or more class names (space separated) to be added to or removed from the class attribute of each matched element.

duration

A string or number determining how long the animation will run.

easing

A string indicating which easing function to use for the transition.

complete

A js function to call once the animation is complete, called once per matched element.

removeClassName

One or more class names (space separated) to be removed from the class attribute of each matched element.

addClassName

One or more class names (space separated) to be added to the class attribute of each matched element.

Details

These functions are the R wrappers of addClass(), removeClass() and switchClass() from jQuery UI library. They should be used in server of a shiny app.

Examples

if (FALSE) {
  # in shiny ui create a span
  tags$span(id = 'foo', 'class animation demo')

  # in shiny server add class 'lead' to the span
  jqui_add_class('#foo', className = 'lead')
}