Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap: Scroll top on statusbar tap

I am implementing a webapp using jQuery Mobile and Phonegap. One thing I am missing, is the following: The App should scroll to the top when the statusbar is tapped.

I have already seen that using Objective C one has to indicate the view that has to scroll to top on tap. Is it possible to do something similar with Javascript/Phonegap?

like image 834
Chagemei Avatar asked May 23 '12 07:05

Chagemei


2 Answers

Update for 22.9.2016

It's working fine

Plugin ID has changed, install it using:

cordova plugin add cordova-plugin-statusbar

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


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

Install:

cordova plugin add org.apache.cordova.statusbar

In your javascript:

window.addEventListener('statusTap', function() {
    //scroll-up or do whatever you want
});
like image 117
guya Avatar answered Oct 16 '22 03:10

guya


I wrote a plugin to solve this issue

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

you can register tap events on the status bar and handle this all in code. With an event listener.

like image 31
j_mcnally Avatar answered Oct 16 '22 03:10

j_mcnally