-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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
Increase performance of .btn with touchstart #3772
Comments
Yeah - it's a good point. We need to spend some time going through mobile stuff. |
thanks, since Bootstrap CSS is really easy for designing one web app to run everywhere (responsive design, etc.) it seems only natural to have the javascript also be designed in this fashion. I'm using Bootstrap with this one code base in mind so would be happy to contribute to a big push on this... |
Hi guys, I'm currently working on an Idea wich could be easy to implement. That's why I isolated the code responsible for tap events and changed twitter bootstrap to take this into account. Results are pretty good ! There can be some problems when you tap to quickly. You can try on your mobile here : |
@t0k4rt thanks Alexandre, i've having trouble determining the difference between your jquery mobile radio buttons and the default twitter bootstrap radio buttons, might you clarify how you are detecting the performance improvement? Also, as a more general point, i was originally thinking Twitter Bootstrap should include some kind of Touch API that would work on all elements with thanks for taking a shot at this! |
Hello Tim, When you tap the on the button, the button is "activating" state faster Also, when you deal with radio style buttons, it still take time to But on the whole I think it's better much responsive from the user side. Concerning your second question, I only modified twitter bootstrap $("a.btn").on('tap', function (e) { Maybe it's faster ! |
This might need some tweaking, but this is how I do it: $('a, button').bind('touchend', function(e) {
$(this).trigger('click');
e.preventDefault();
}); |
@t0k4rt thanks for the video, I tried the same comparison yesterday, yes you've made a nice improvement. Thanks! So implementing your code, I just include the Just for brainstorming and others who come across this thread, it would be also awesome if Bootstrap button clicking was tethered to swipe events as done in http://swipejs.com. Anwyay, again great work! |
Hello Tim, If you plan to use grouped buttons, radio or checkbox style buttons, you should also take the modified bootstrap files.
If you plan to use on links and button you should include code from monken used that way :
is it clear for you ? Concerning swipejs, I haven't tried yet but it could be a sweet solution to use with bootstrap carousel plugin. |
@t0k4rt So back to my original question if you don't mind. If one puts the following code on their site:
and clicks on links or buttons while using a mobile browser, then they won't experience the 300ms delay caused by checking for double-taps? The links/buttons will instead fire as fast as thanks again! |
There's also a project called Fastclick from guys at FT Labs, maybe this could be useful in this case: https://github.com/ftlabs/fastclick |
Thanke a lot, I will check that, |
I'm thinking something like fastclick is a better universal solution for this feature request then trying to add it to all our plugins individually… so i'm going to close in favor of that for now. thanks! |
I did not mean to re-open this by referencing it. Please close. Thanks! |
I was thinking it could be good to invoke
touchstart
on all Bootstrap buttons withclass="btn"
. This would make use of the code in this post: https://developers.google.com/mobile/articles/fast_buttons?hl=de-DE.The point is performance and to make Bootstrap button clicks be as fast touch events.
I apologize if this already has been addressed elsewhere.
thanks,
tim
The text was updated successfully, but these errors were encountered: