-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fires click when stop scroll with tap/click #1438
Comments
Can you explain a little more about how we can replicate the issue? |
Yes, follow this steps: 1 - Scroll the list scrolling down taking out your finger off the screen (long scroll) |
The default behavior is only stop de scroll, but today (b5) ionic stops the scroll and fires a click event! |
Hey @AdamBradley, here's an example http://codepen.io/perrygovier/pen/ntibg Note, I'm seeing this on mobile and desktop. |
@adamdbradley, i'm waiting only this issue for publish my first app on App Store, can you help me? |
I made a work around, maybe this help to solve this issue. My ion-content: on-scroll="scrollList()" My Controller: $scope.lastScrolling = new Date().getTime();
$scope.scrollList = function() {
$scope.lastScrolling = new Date().getTime();
};
$scope.canClickInList = function() {
var diff = new Date().getTime() - $scope.lastScrolling;
if (diff > 200) {
return true;
} else {
return false;
}
}; And finally, in my function to click above item in controller: if ($scope.canClickInList()) {
// ACTION
} |
I also wanted to solve this issue, which still exists for iOS 8.0.2 in 1.0.0-beta.13, but I made a slightly different workaround, inspired by @juliancesar's but without all the My ion-content: on-scroll="incrementScrollCount()" on-scroll-complete="resetScrollCount()" My controller: var scrollCount = 0, prevScrollCount = 0;
$scope.incrementScrollCount = function() {
scrollCount += 1;
}
$scope.resetScrollCount = function() {
prevScrollCount = scrollCount;
scrollCount = 0;
} In my ng-click function: if (prevScrollCount <= 1) {
// ACTION
} It seems to work because only one on-scroll call is made between the on-scroll-complete call and the ng-click call when the user taps once without swiping, but I'd prefer something nicer and more stable, if possible. This behavior is common among native iOS apps (one example being Settings on an iPad), so I would expect users to expect it in mine. |
An update: It turns out my solution is unreliable since no specific order is guaranteed for the various callbacks, and in fact on-scroll-complete is not even guaranteed to fire when the user stops the scrolling with a tap. (I suppose nothing at all is guaranteed about on-scroll-complete since it isn't mentioned in the documentation.) Instead, I'm now using a solution much like @juliancesar's but using I would still like a vanilla solution, please! |
+1 |
Hello guys, I found a solution by editing "ionic.bundle.js"
*I use "on-tap" directives to handle click events. |
related: #2665 |
This is actually still happening for me with ionic 1.7.7 I am using a directive for the scrollable list with something that looks like this:
|
This issue still exists on my app, although it's working as expected on PC (with ionic serve). I'm using ionic 2.0. @adamdbradley see the demo http://codepen.io/chrisyuyangshen/pen/BQEzNj |
@juliancesar your solution works well. Thank you all. I wonder if any of you guys or other fellows can convert this solution into a directive, so that we don't anymore need to copy paste the calculation logic and the click event handler into every controller where this solution is going to be used. Also the view may become cleaner if For example:
where |
+1 This issue still exists for me on ios using the latest ionic2. |
I modified the code of @juliancesar and @insectean, then moved it to a service called
Now, after injecting In your controller:
And in your ion-content and ion-list:
That's it! Note: Optionally, you can pass a callback function to the
And
|
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
The default behavior is only stop scroll, but in ionic the scroll stops and fires the click.
Someone else with same problem?
iOS 7.1.1
iPhone 5
Ionic 1.0.0-beta.b5
The text was updated successfully, but these errors were encountered: