Telephone: scroll to the top of the status bar

I use webapp using jQuery Mobile and Phonegap. One thing that I skip is this: the application should scroll up when the status bar is displayed.

I have already seen that using Objective-C, you need to specify the view that you want to scroll up when clicked. Is it possible to do something similar with Javascript / Phonegap?

+6
source share
3 answers

Update for 9/22/2016

Works fine

The plugin id has changed, install it using:

cordova plugin add cordova-plugin-statusbar 

Tested with cordova-6.3.1 cordova-ios-4.2.2 on iOS 10.0 and iPhone 6s Plus simulator running 9.3.5.


The official status plugin has this feature. https://github.com/apache/cordova-plugin-statusbar

Installation:

 cordova plugin add org.apache.cordova.statusbar 

In your javascript:

 window.addEventListener('statusTap', function() { //scroll-up or do whatever you want }); 
+6
source

I wrote a plugin to solve this problem

https://github.com/j-mcnally/cordova-statusTap

You can log crane events in the status bar and handle all this in code. With an event listener.

+4
source

if the content displayed in the phonegap application is larger than the borders of the web view, scrolling occurs automatically.

Otherwise - for example, if you just scroll the div using -webkit-overflow-scrolling - you need to use the solution found here: How to detect strokes in the status bar

In scrollViewShouldScrollToTop you need to call

 [theWebView stringByEvaluatingJavaScriptFromString:"should_scroll_to_top"]; 

should_scroll_to_top is a normal function in js.

0
source

Source: https://habr.com/ru/post/916426/


All Articles