New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pagebeforehide return 'undefined' for ui.nextPage #700

Closed
jstrimpel opened this Issue Dec 18, 2010 · 3 comments

Comments

Projects
None yet
4 participants
@jstrimpel

jstrimpel commented Dec 18, 2010

pagebeforehide and pagebeforeshow are returning undefined when referencing ui.prevPage and ui.nextPage. I have tried various different combinations since the documentation states that 'Note that all four of these events expose a reference to either the next page (nextPage) or previous page (prevPage), depending on whether the page is being shown or hidden', but nothing has worked thus far.

$('div').live('pagebeforehide',function(event, ui){
console.log(ui.nextPage.attr('id'));
});

@jeffv

This comment has been minimized.

Show comment
Hide comment
@jeffv

jeffv Dec 23, 2010

I can confirm this issue. I tried all four events and they all behave erratically when exposing the references to nextPage/prevPage.

For example:
'pagebeforeshow': nextPage is always undefined. prevPage is only defined if there is no prevPage (giving an empty jquery object as expected).

'pagehide': prevPage is always undefined. nextPage appears as expected

'pagebeforehide': both prevPage and next page are always undefined.

'pageshow': nextPage always undefined, prevPage works as expected

jeffv commented Dec 23, 2010

I can confirm this issue. I tried all four events and they all behave erratically when exposing the references to nextPage/prevPage.

For example:
'pagebeforeshow': nextPage is always undefined. prevPage is only defined if there is no prevPage (giving an empty jquery object as expected).

'pagehide': prevPage is always undefined. nextPage appears as expected

'pagebeforehide': both prevPage and next page are always undefined.

'pageshow': nextPage always undefined, prevPage works as expected

@scottjehl

This comment has been minimized.

Show comment
Hide comment
@scottjehl

scottjehl Mar 23, 2011

Contributor

So, these are more consistent now, but the idea is that you'd bind to the div that's being shown or hidden, so "this" refers to the target, and nextPage or prevPage gives you the other page involved in the transition.

$("div")
.live("pagebeforeshow pageshow",function(e,ui){
    console.log(e.type + " " + ui.prevPage );
}).live("pagebeforehide pagehide",function(e,ui){
    console.log(e.type + " " + ui.nextPage );
});

That said, the above tests out fine for me so I'm closing this as fixed. Let us know if you run into any issues given the explanation above and we'll be sure to document it better in the end.

Contributor

scottjehl commented Mar 23, 2011

So, these are more consistent now, but the idea is that you'd bind to the div that's being shown or hidden, so "this" refers to the target, and nextPage or prevPage gives you the other page involved in the transition.

$("div")
.live("pagebeforeshow pageshow",function(e,ui){
    console.log(e.type + " " + ui.prevPage );
}).live("pagebeforehide pagehide",function(e,ui){
    console.log(e.type + " " + ui.nextPage );
});

That said, the above tests out fine for me so I'm closing this as fixed. Let us know if you run into any issues given the explanation above and we'll be sure to document it better in the end.

@scottjehl scottjehl closed this Mar 23, 2011

fcheslack pushed a commit to fcheslack/jquery-mobile that referenced this issue Jul 28, 2011

@sbudhram

This comment has been minimized.

Show comment
Hide comment
@sbudhram

sbudhram Nov 11, 2011

Please update the documentation on this issue. The docs are still incorrectly stating that 'pagehide' event has the prevPage attribute. I had to search for a while to find this.

sbudhram commented Nov 11, 2011

Please update the documentation on this issue. The docs are still incorrectly stating that 'pagehide' event has the prevPage attribute. I had to search for a while to find this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment