User changes CMS Page
webflow.subscribe("currentcmsitem", callback)
Use this method to listen for specific events in your app. When a user selects a collection page or chooses a new CMS item on a collection page, this event will trigger. This can be especially useful for determining the path of auto-generated pages from a CMS or Ecommerce collection.
Syntax
Parameters
event
: "currentpage"
The name of the event to subscribe to.
callback: (() => void)
The callback function to execute when the event occurs.
Returns
Unsubscribe
This is a special function returned after subscribing. Call this function when you want to stop listening to the event and discontinue receiving notifications.