File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,24 @@ $.extend( $.mobile, {
255
255
this . loading . _widget = loader ;
256
256
257
257
return returnValue ;
258
+ } ,
259
+
260
+ isElementCurrentlyVisible : function ( el ) {
261
+ el = typeof el === "string" ? $ ( el ) [ 0 ] : el [ 0 ] ;
262
+
263
+ if ( ! el ) {
264
+ return 1 ;
265
+ }
266
+
267
+ var rect = el . getBoundingClientRect ( ) ;
268
+
269
+ return (
270
+ rect . bottom > 0 &&
271
+ rect . right > 0 &&
272
+ rect . top <
273
+ ( window . innerHeight || document . documentElement . clientHeight ) &&
274
+ rect . left <
275
+ ( window . innerWidth || document . documentElement . clientWidth ) ) ;
258
276
}
259
277
} ) ;
260
278
Original file line number Diff line number Diff line change @@ -216,7 +216,8 @@ return $.widget( "mobile.panel", {
216
216
( heightWithMargins - heightWithoutMargins ) ) ;
217
217
}
218
218
}
219
- if ( scrollToTop === true ) {
219
+ if ( scrollToTop === true &&
220
+ ! $ . mobile . isElementCurrentlyVisible ( ".ui-content" ) ) {
220
221
this . window [ 0 ] . scrollTo ( 0 , $ . mobile . defaultHomeScroll ) ;
221
222
}
222
223
} else {
You can’t perform that action at this time.
0 commit comments