# Default iOS tap on top behavior

**URL:** <https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615>\
**Category:** ionic-v1\
**Created:** [March 6, 2014, 3:19am UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615 "2014-03-06T03:19:41Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliancesar](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@juliancesar](https://forum.ionicframework.com/u/juliancesar)\
**Post date:** [March 6, 2014, 3:19am UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/1 "2014-03-06T03:19:42Z")

</div>

Hi, how can i simulate a default iOS behavior tap on status bar to scroll to top content?

---

<div class="post-metadata">

**Author:** ![abekim](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@abekim](https://forum.ionicframework.com/u/abekim)\
**Post date:** [March 6, 2014, 3:47am UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/2 "2014-03-06T03:47:33Z")

</div>

I’m also interested in implementing this in my app. While I personally haven’t had a change to try it, some ways to reset the content scroll seem to have been suggested in [this issue](http://forum.ionicframework.com/t/how-to-reset-content-scroll/272) - specifically `$ionicScrollDelegate`. You can probably catch the tap events using [ionic’s gestures] ([http://ionicframework.com/docs/angularjs/utils/gestures/](http://ionicframework.com/docs/angularjs/utils/gestures/)) or [Hammer.js] ([http://eightmedia.github.io/hammer.js/](http://eightmedia.github.io/hammer.js/)) (suggested on the gestures page), and reset content scroll once the event triggers.

---

<div class="post-metadata">

**Author:** ![juliancesar](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@juliancesar](https://forum.ionicframework.com/u/juliancesar)\
**Post date:** [March 6, 2014, 4:55am UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/3 "2014-03-06T04:55:09Z")

</div>

Tks to reply @abekim !  
See my code below, i’m doing some thing wrong? My Status bar is working great, but the tap doesn’t!

```
.directive('fadebar', function($timeout, $ionicGesture) {
            return {
                restrict: 'E',
                template: '<div class="fade-bar"></div>',
                replace: true,
                link: function($scope, $element, $attr) {

                    // Run in the next scope digest
                    // CODE TO STATUS BAR TRANSLU

                    var tapFn = function(e) {
                        alert('TEST');
                    };
                    var tapGesture = $ionicGesture.on('tap', tapFn, $element[0]);
                    $scope.$on('$destroy', function() {
                        $ionicGesture.off(tapGesture, 'tap', tapFn);
                    });

                }
            }
        })
```

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [March 6, 2014, 3:11pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/4 "2014-03-06T15:11:33Z")

</div>

Ionic already has the functionality where a tap on the top of the `nav-bar` causes the view to scroll to the top. This works for me in iOS ( 6 & 7) and in Chrome. Now admittedly, you have to tap on `nav-bar` rather than the status bar, but it seems to work fine.

Here’s a short demo:

![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/216/0976024f11c35045.gif)

Is it not working for you? What version of Ionic are you using?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [March 6, 2014, 3:55pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/5 "2014-03-06T15:55:39Z")

</div>

@Calendee I’m getting this to work in Chorme, but it seems buggy on my phone (iPhone 5, iOS 7.06). It did work a few version back, but I’ve been using the nightly builds for a while now that I cannot remember which version I started having issues.

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [March 6, 2014, 3:57pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/6 "2014-03-06T15:57:44Z")

</div>

Thanks for the info. I’m mainly using 0.9.25 right now on my app; so, I haven’t ventured far with any other version. I’ll put together a simple app to test between 0.9.25, 0.9.26, and nightlies.

---

<div class="post-metadata">

**Author:** ![juliancesar](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@juliancesar](https://forum.ionicframework.com/u/juliancesar)\
**Post date:** [March 6, 2014, 4:37pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/7 "2014-03-06T16:37:26Z")

</div>

@Calendee, it’s not working for me.  
I use the last version (0.9.26)! I’ll test in older versions too.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [March 6, 2014, 4:40pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/8 "2014-03-06T16:40:49Z")

</div>

Did you try in the browser (Chrome) or on an actual device?

---

<div class="post-metadata">

**Author:** ![juliancesar](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@juliancesar](https://forum.ionicframework.com/u/juliancesar)\
**Post date:** [March 6, 2014, 4:43pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/9 "2014-03-06T16:43:03Z")

</div>

At the time only in my device. iPhone 5 with iOS 7.0.6.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [March 6, 2014, 5:03pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/10 "2014-03-06T17:03:15Z")

</div>

So I did get it to work (had to switch to an iPad for some reason). I had to keep tapping on the header and moving my finger around though, so this can be problematic.

---

<div class="post-metadata">

**Author:** ![juliancesar](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@juliancesar](https://forum.ionicframework.com/u/juliancesar)\
**Post date:** [March 6, 2014, 9:35pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/11 "2014-03-06T21:35:09Z")

</div>

Don’t working in **0.9.25** , **0.9.26** and **0.10.0-alpha-1051 (2014-03-06)**!  
Some times work, but i need to tap many times such as @mhartington said! I think its a bug!  
My app have a StatusBar plugin and a fadebar directive.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [March 6, 2014, 10:04pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/12 "2014-03-06T22:04:09Z")

</div>

I got the fade bar too…could be the issue. I’ll test with an android device and report back in bit

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [March 7, 2014, 2:21pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/13 "2014-03-07T14:21:06Z")

</div>

So I just tested this on an android device and I’m starting to think that it is the fade bar directive. To make sure it only appeared on iOS7, I added the platform specific class to it as well.

```
.platform-ios7 .fade-bar {
	height: 20px;
	width: 100%;
	position: fixed;
	z-index: 9999;
	opacity: 0;
	background-color: #000;
	position: absolute;
	top: 0px;
}

```

So the fade bar isn’t even there on anything device that isn’t an iOS7 device. Tried taking the fade bar out from my iOS project, and it worked like a charm.

So the issue seems to be that when you tap the header, it thinks you’re tapping the fade bar and no the header it self.

---

<div class="post-metadata">

**Author:** ![jough](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jough/32/7887_2.png) [@jough](https://forum.ionicframework.com/u/jough)\
**Post date:** [March 7, 2014, 2:49pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/14 "2014-03-07T14:49:35Z")

</div>

I’m using an ion-nav-bar and no fade directive and it doesn’t work for me - it looks like it’s broken in tabs - you can see the broken behavior in the Ionic Codepen demo too: [http://codepen.io/ionic/pen/KbrzJ](http://codepen.io/ionic/pen/KbrzJ)

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [March 7, 2014, 2:54pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/15 "2014-03-07T14:54:26Z")

</div>

It’s working when I go to the codepen, in both safari and chrome

---

<div class="post-metadata">

**Author:** ![jough](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jough/32/7887_2.png) [@jough](https://forum.ionicframework.com/u/jough)\
**Post date:** [March 7, 2014, 3:03pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/16 "2014-03-07T15:03:36Z")

</div>

I can get it to work by clicking a bunch of times (triple taps seem to work?), but it’s really flaky, and no matter how furiously I tap it doesn’t work on any iOS or Android device I’ve tried.

---

<div class="post-metadata">

**Author:** ![Calendee](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/calendee/32/13656_2.png) [@Calendee](https://forum.ionicframework.com/u/Calendee)\
**Post date:** [March 9, 2014, 2:28pm UTC](https://forum.ionicframework.com/t/default-ios-tap-on-top-behavior/1615/17 "2014-03-09T14:28:27Z")

</div>

Sorry it took me so long to get back to this. I’ve setup on device and confirm that the `tapScrollToTop` is very intermittent.

I’ve opened Issue # 750 : [https://github.com/driftyco/ionic/issues/750](https://github.com/driftyco/ionic/issues/750)
