|
409 | 409 |
|
410 | 410 | lastScrollEnabled = false; |
411 | 411 |
|
412 | | - var active = $.mobile.urlHistory.getActive(); |
| 412 | + var active = $.mobile.urlHistory.getActive(), |
| 413 | + activePage = $( ".ui-page-active" ), |
| 414 | + scrollElem = $( window ), |
| 415 | + touchOverflow = $.support.touchOverflow && $.mobile.touchOverflowEnabled; |
| 416 | + |
| 417 | + if( touchOverflow ){ |
| 418 | + scrollElem = activePage.is( ".ui-native-fixed" ) ? activePage.find( ".ui-content" ) : activePage; |
| 419 | + } |
413 | 420 |
|
414 | 421 | if( active ){ |
415 | | - var lastScroll = $.support.touchOverflow ? $( ".ui-page-active" ).scrollTop() : $( window ).scrollTop(); |
| 422 | + var lastScroll = scrollElem.scrollTop(); |
416 | 423 |
|
417 | 424 | // Set active page's lastScroll prop. |
418 | 425 | // If the Y location we're scrolling to is less than minScrollBack, let it go. |
|
429 | 436 | // Make the iOS clock quick-scroll work again if we're using native overflow scrolling |
430 | 437 | /* |
431 | 438 | if( $.support.touchOverflow ){ |
432 | | - $( window ).bind( "scrollstop", function(){ |
433 | | - if( $( this ).scrollTop() === 0 ){ |
434 | | - $.mobile.activePage.scrollTop( 0 ); |
435 | | - } |
436 | | - }); |
| 439 | + if( $.mobile.touchOverflowEnabled ){ |
| 440 | + $( window ).bind( "scrollstop", function(){ |
| 441 | + if( $( this ).scrollTop() === 0 ){ |
| 442 | + $.mobile.activePage.scrollTop( 0 ); |
| 443 | + } |
| 444 | + }); |
| 445 | + } |
437 | 446 | } |
438 | 447 | */ |
439 | 448 |
|
|
442 | 451 |
|
443 | 452 | //get current scroll distance |
444 | 453 | var active = $.mobile.urlHistory.getActive(), |
445 | | - toScroll = active.lastScroll || ( $.support.touchOverflow ? 0 : $.mobile.defaultHomeScroll ), |
| 454 | + touchOverflow = $.support.touchOverflow && $.mobile.touchOverflowEnabled, |
| 455 | + toScroll = active.lastScroll || ( touchOverflow ? 0 : $.mobile.defaultHomeScroll ), |
446 | 456 | screenHeight = getScreenHeight(); |
447 | | - |
| 457 | + |
448 | 458 | // Scroll to top, hide addr bar |
449 | 459 | window.scrollTo( 0, $.mobile.defaultHomeScroll ); |
450 | 460 |
|
|
453 | 463 | fromPage.data( "page" )._trigger( "beforehide", null, { nextPage: toPage } ); |
454 | 464 | } |
455 | 465 |
|
456 | | - if( !$.support.touchOverflow ){ |
| 466 | + if( !touchOverflow){ |
457 | 467 | toPage.height( screenHeight + toScroll ); |
458 | 468 | } |
459 | 469 |
|
|
462 | 472 | //clear page loader |
463 | 473 | $.mobile.hidePageLoadingMsg(); |
464 | 474 |
|
465 | | - if( $.support.touchOverflow && toScroll ){ |
| 475 | + if( touchOverflow && toScroll ){ |
| 476 | + |
466 | 477 | toPage.addClass( "ui-mobile-pre-transition" ); |
467 | 478 | // Send focus to page as it is now display: block |
468 | 479 | reFocus( toPage ); |
469 | 480 |
|
470 | 481 | //set page's scrollTop to remembered distance |
471 | | - toPage.scrollTop( toScroll ); |
| 482 | + if( toPage.is( ".ui-native-fixed" ) ){ |
| 483 | + toPage.find( ".ui-content" ).scrollTop( toScroll ); |
| 484 | + } |
| 485 | + else{ |
| 486 | + toPage.scrollTop( toScroll ); |
| 487 | + } |
472 | 488 | } |
473 | 489 |
|
474 | 490 | //find the transition handler for the specified transition. If there |
|
479 | 495 |
|
480 | 496 | promise.done(function() { |
481 | 497 | //reset toPage height back |
482 | | - if( !$.support.touchOverflow ){ |
| 498 | + if( !touchOverflow ){ |
483 | 499 | toPage.height( "" ); |
484 | 500 | // Send focus to the newly shown page |
485 | 501 | reFocus( toPage ); |
486 | 502 | } |
487 | 503 |
|
488 | 504 | // Jump to top or prev scroll, sometimes on iOS the page has not rendered yet. |
489 | | - if( !$.support.touchOverflow ){ |
| 505 | + if( !touchOverflow ){ |
490 | 506 | $.mobile.silentScroll( toScroll ); |
491 | 507 | } |
492 | 508 |
|
493 | 509 | //trigger show/hide events |
494 | 510 | if( fromPage ) { |
495 | | - if( !$.support.touchOverflow ){ |
| 511 | + if( !touchOverflow ){ |
496 | 512 | fromPage.height( "" ); |
497 | 513 | } |
498 | 514 |
|
|
0 commit comments