Skip to content

Commit 69583d1

Browse files
author
scottjehl
committed
set up silentScroll with a second argument for a target element
1 parent a23e104 commit 69583d1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

js/jquery.mobile.core.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@
9494
},
9595

9696
// Scroll page vertically: scroll to 0 to hide iOS address bar, or pass a Y value
97-
silentScroll: function( ypos ) {
97+
silentScroll: function( ypos, elem ) {
98+
99+
var elem = elem && elem[ 0 ] || window;
100+
98101
if ( $.type( ypos ) !== "number" ) {
99102
ypos = $.mobile.defaultHomeScroll;
100103
}
@@ -103,7 +106,7 @@
103106
$.event.special.scrollstart.enabled = false;
104107

105108
setTimeout(function() {
106-
window.scrollTo( 0, ypos );
109+
elem.scrollTo( 0, ypos );
107110
$( document ).trigger( "silentscroll", { x: 0, y: ypos });
108111
}, 20 );
109112

0 commit comments

Comments
 (0)