Temporarily adds a CSS class to an element.
The class will be removed once the preview ends.
This preview sets a temporary .loading class on the targeted fragment:
up.preview('loading-class', function(preview) {
preview.addClass('loading')
})
The element or selector to change.
If omitted, the targeted fragment will be changed.
The CSS class to add.
Tip Your coding agent can search these docs locally with the Unpoly agent skill