2023-04-25 13:25:59 +02:00

2.0 KiB
Executable File

Events

The following callback events can be passed to iframe-resizer on the parent page, as part of the options object.

onClose

onClose: (iframeID) => boolean

Called before iFrame is closed via parentIFrame.close() or iframe.iFrameResizer.close() methods. Returning false will prevent the iFrame from closing.

onClosed

onClosed: (iframeID) => undefined

Called after iFrame is closed via parentIFrame.close() or iframe.iFrameResizer.close() methods.

onInit

onInit: (iframe) => undefined

Called after initial setup.

onMessage

onMessage: ({iframe,message}) => undefined

Receive message posted from iFrame with the parentIFrame.sendMessage() method.

onMouseEnter

onMouseEnter: ({iframe,height,width,type}) => undefined

Function called after the mouse enters the iframe. Passes messageData object containing the iFrame, screenX, screenY and the type of event that triggered the callback.

onMouseLeave

onMouseLeave: ({iframe,height,width,type}) => undefined

Function called after the mouse leaves the iframe. Passes messageData object containing the iFrame, screenX, screenY and the type of event that triggered the callback.

onResized

onResized: ({iframe,height,width,type}) => undefined

Function called after iFrame resized. Passes messageData object containing the iFrame, height, width and the type of event that triggered the iFrame to resize.

onScroll

onScroll: ({x,y}) => [true|false]

Called before the page is repositioned after a request from the iFrame, due to either an in page link, or a direct request from either parentIFrame.scrollTo() or parentIFrame.scrollToOffset(). If this function returns false, it will stop the library from repositioning the page, so that you can implement your own animated page scrolling instead.