Edit this page

up.Preview up.Preview.prototype.addClass([element], className)
Instance method

Temporarily adds a CSS class to an element.

The class will be removed once the preview ends.

Example

This preview sets a temporary .loading class to the targeted fragment:

up.preview('loading-attr', function(preview) {
  preview.addClass('loading')
})

Parameters

[element=this.fragment] Element|string optional

The element or selector to change.

If omitted, the targeted fragment will be changed.

className string

The CSS class to add.