Permalink
Browse files

Better one line fix

  • Loading branch information...
jansepar committed Feb 15, 2013
1 parent b8c1bf9 commit 8c9de025d1be86aa53fcc28882261b7efa3db26a
Showing with 27 additions and 5 deletions.
  1. +27 −5 www/static/modules/accordion/accordion.js
@@ -56,12 +56,34 @@ Mobify.UI.Utils = (function($) {
return;
};
+ // determine which transition event to use
+ function whichTransitionEvent(){
+ // http://stackoverflow.com/questions/5023514/how-do-i-normalize-css3-transition-functions-across-browsers
+ // hack for ios 3.1.* because of poor transition support.
+ if (/iPhone\ OS\ 3_1/.test(navigator.userAgent)) {
+ return undefined;
+ }
+
+ var el = document.createElement('fakeelement');
+ var transitions = {
+ 'transition':'transitionEnd transitionend',

This comment has been minimized.

Show comment Hide comment
@johnboxall

johnboxall Feb 15, 2013

Owner

@jansepar Where my comments at? Why are we using two events here again?

@johnboxall

johnboxall Feb 15, 2013

Owner

@jansepar Where my comments at? Why are we using two events here again?

This comment has been minimized.

Show comment Hide comment
@jansepar

jansepar Feb 15, 2013

Contributor

The codesnippet here is from stack overflow, which is taken from Modernizr:

http://stackoverflow.com/questions/5023514/how-do-i-normalize-css3-transition-functions-across-browsers/9090128#9090128

Seems it has been updated recently to use transitionend instead of transitionEnd on Firefix (read the comments on the accepted answer). Since I'm not sure if this is the case for ALL browsers, I left it on both events just incase (it doesn't hurt!). Also, another comment was that Opera updated to all lowercase - should fix that as well!

@jansepar

jansepar Feb 15, 2013

Contributor

The codesnippet here is from stack overflow, which is taken from Modernizr:

http://stackoverflow.com/questions/5023514/how-do-i-normalize-css3-transition-functions-across-browsers/9090128#9090128

Seems it has been updated recently to use transitionend instead of transitionEnd on Firefix (read the comments on the accepted answer). Since I'm not sure if this is the case for ALL browsers, I left it on both events just incase (it doesn't hurt!). Also, another comment was that Opera updated to all lowercase - should fix that as well!

+ 'OTransition':'oTransitionEnd',
+ 'MSTransition':'msTransitionEnd',
+ 'MozTransition':'transitionend',
+ 'WebkitTransition':'webkitTransitionEnd'
+ }
+
+ var t;
+ for(t in transitions){
+ if( el.style[t] !== undefined ){
+ return transitions[t];
+ }
+ }
+ return;
+ };
+
$.extend(exports.events, {
- 'transitionend': [ "transitionEnd",
- "oTransitionEnd",
- "msTransitionEnd",
- "transitionend",
- "webkitTransitionEnd" ].join(" ")
+ 'transitionend': whichTransitionEvent()
});

0 comments on commit 8c9de02

Please sign in to comment.