ECompare Compare
Examples
Drag comparison
Hover comparison
Vertical comparison
Custom handle
Keyboard and endpoints
Properties
PropertyDescriptionValues and default
valuerealPercentage of the before content revealed, from 0 to 100.
Default
50hoverboolUpdate comparison ratio on pointer hover.
Default
falseafterSourceurlImage URL for the after layer.
Default
""beforeSourceurlImage URL for the before layer.
Default
""verticalboolUse a horizontal divider to reveal content vertically.
Default
falseafterComponentComponentCustom content replacing the after image.
Default
nullbeforeComponentComponentCustom content replacing the before image.
Default
nullhandleComponentComponentCustom comparison handle content.
Default
nullfractionrealRead onlyComparison fraction clamped between 0 and 1.
Default
isFinite(value) ? Math.max(0, Math.min(100, value)) / 100 : 0.5Signals
SignaturePurpose
moved(real value)Emitted when the user adjusts the comparison divider; value is its position.
Methods
SignaturePurpose
setValue(next)Set a new numeric value within the component limits.