-
Notifications
You must be signed in to change notification settings - Fork 2.4k
pagecontainerbeforehide and pagecontainerbeforeshow data should contain both pages #7176
Comments
The function that needs changing: https://github.com/jquery/jquery-mobile/blob/ecc9fa25d117d2cf85f99b5bf9cdcd3cfb01603d/js/widgets/pagecontainer.js#L751 |
This will also fix events pagecontainershow and pagecontainerhide which will improve the fix for #7085, because in the handler defined in the demo at demos/toolbar-fixed-persistent/ we no longer have to grab the active page via |
It seems to me this is just a nicety, since (presumably?) you can rely on fetching the active page in these two instances. (And that would be the workaround for now...) It certainly would be nice, though, for the parameters to be consistent. Aside: The wordiness of working with the new events is painful. Most of us will wind-up either keeping a more terse variable around in our own JS, or simply letting events bubble up to I understand the reasons for the internal structure. But does it have to be exposed in (only) such a raw way to developers? There has to be a better way. (I'll do a separate Issue on this wordiness issue after some thought, and checking for existing Issues. This has been really bugging me... It's a serious blocker to clarity.) |
@jtara, the widget factory allows you to attach event handlers via the constructor mechanism: $( ":data('mobile-pagecontainer')" ).pagecontainer({
beforeshow: function( event, ui ) {},
beforehide: function( event, ui ) {},
show: function( event, ui ) {},
hide: function( event, ui ) {}
}); This way you can avoid some of the wordiness. |
It seems to me this is just a nicety, since (presumably?) you can rely on fetching the active page in these two instances. (And that would be the workaround for now...) That is true for |
To make sure all former page events have a page container counterpart, and that this counterpart has both a toPage and prevPage prop on the ui object Also add a demo of how to debug pagecontainer events Fixes jquery-archivegh-7063 Fixes jquery-archivegh-7283 Fixes jquery-archivegh-7176 Closes jquery-archivegh-7285
... otherwise, if you trap pagecontainerbeforeshow, you have no idea which page is being shown, because the event is triggered on the pagecontainer, not the page being shown.
Conversely, if you trap pagecontainerbeforehide, you have no idea which page is being hidden, because the event is triggered on the pagecontainer, not the page being hidden.
Currently (as of post-1.4.1), your only course of action is to listen to the deprecated pagebeforehide and pagebeforeshow events.
The text was updated successfully, but these errors were encountered: