W3cubDocs

/jQuery Mobile

updatelayout

updatelayout eventversion added: 1.0

Description: Triggered by components within the framework that dynamically show/hide content.

  • jQuery( ".selector" ).on( "updatelayout", function( event ) { ... } )

Some components within the framework, such as collapsible and listview search, dynamically hide and show content based on user events. This hiding/showing of content affects the size of the page and may result in the browser adjusting/scrolling the viewport to accommodate the new page size. Since this has the potential to affect other components such as fixed headers and footers, components like collapsible and listview trigger a custom updatelayout event to notify other components that they may need to adjust their layouts in response to their content changes. Developers who are building dynamic applications that inject, hide, or remove content from the page, or manipulate it in any way that affects the dimensions of the page, can also manually trigger this updatelayout event to ensure components on the page update in response to the changes.

This event is triggered by components within the framework that dynamically show/hide content, and is meant as a generic mechanism to notify other components that they may need to update their size or position. Within the framework, this event is fired on the component element whose content was shown/hidden, and bubbles all the way up to the document element.

$( "#foo" ).hide().trigger( "updatelayout" );

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jquerymobile.com/updatelayout