Edit this page

up.Preview up.Preview.prototype.hideContent([element])
Instance method

This feature is experimental. Please share your experiences so we know what to keep or change.

Temporarily hides the children of an element.

The children will be shown when the preview ends.

Tip

To visually remove elements during a preview, prefer hiding over detaching. See Prefer additive changes.

Example

This preview (visually) replaces the children of the targeted fragment with a .spinner element:

up.preview('spinner', function(preview) {
  preview.hideChildren()
  preview.insert('<span class="spinner">Please wait...</span>')
})

For a more concise way to temporarily swap the children with a temporary element, see the swapContent() method.


Parameters

[element=this.fragment] Element|string optional

The element or selector to hide the children off.

If omitted, the children of the targeted fragment will be hidden.