-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Firefox 26.0 onTouchStart vs ontouchstart #958
Comments
Same problem with FlexSlider 2.2.2 + FireFox 26.0 No problem with Chrome 31 and IE 11 EDIT : problem solved by moving el.addEventListener('touchstart', onTouchStart, false); AFTER function onTouchStart(e) { ... } |
This is quite a major bug. Are there any plans to put the fix into a new release? |
There are plans, yes. If you have a fix, please do submit a pull request on the “master” branch. Thanks. :) Matt Cohen http://woothemes.com/ On Thursday 16 January 2014 at 1:24 PM, Rob wrote:
|
The reason this breaks is it's relying on the function declaration inside the conditional to be hoisted--but that's not really defined behavior pre-ES6. kangax said it best, "Another important trait of function declarations is that declaring them conditionally is non-standardized and varies across different environments. You should never rely on functions being declared conditionally and use function expressions instead." I can cook up a patch in a bit. |
This way it gets hoisted properly and we don't rely on undefined behavior (which doesn't work in some browsers).
I tested your fix and it works fine for me. |
Fix works, but slides aren't fading like they should. See #977. |
Same issue still persists. I'm on V.2.2.2 - Firefix 2.6. UPDATE: lowercase 'ontouchstart' solves it for me with slider version 2.2.0. |
Fix works for me, but now I can't swipe on my iPad/iPhone. |
This way it gets hoisted properly and we don't rely on undefined behavior (which doesn't work in some browsers).
…as function expressions. This way they get hoisted properly and we don't rely on undefined behavior (which doesn't work in some browsers).
I realize I only fixed ontouchstart, but not ontouchmove and ontouchend. Pushed updated patch. |
I tried your updated patch but touch still doesn't work on an iPad. If I use vanilla FlexSlider 2.2.0 then it works fine on an iPad, including swiping, but it won't work on Firefox because of the error in this issue. If I use your fix that redeclares onTouchStart, onTouchEnd and onTouchMove then it works fine in Firefox without errors, and it works on iPads, but swiping does not work. |
Ditto what robme said. |
I don't have an iPad with me today, but emulating it with Chrome Dev tools, it seems that the onTouchStart event (and the other touch events) never actually fire. There are no errors. |
I have the same problems but i could not prove to my colleagues |
I suffered the same issue, however, I think it might relate to the following: causeFirefox has the Responsive Design View as part of Developer Tools. It features touch gesture simulation using the mouse. When this has been used, Firefox enables touch events, but for some reason it doesn't always turn these back off after disabling it. solutionGo to |
https://github.com/miketaylr/FlexSlider/blob/8af7e0d02d332da4ca8e9dc094f6dd4aa3933d6d/jquery.flexslider.js |
@miketaylr @mattyza Above solution make Flexslider work in firefox but stop swiping in touch screen devices, swiping is the main feature of slider or carousel that's why above solution is not appropriate. Any other solutions ? |
Yeah, sorry--there's actually a small bug in my patch. Will try to update the PR today or tomorrow sorry! |
I am also having the same issue as @mufaddalmw. Thanks for your work on this @miketaylr!! |
…as function expressions. This way they get hoisted properly and we don't rely on undefined behavior (which doesn't work in some browsers).
@gudinne @mufaddalmw can you give the latest commit (miketaylr@40b8818) in my branch a test to see if that fixes it? |
I found one strange thing, yesterday I checked flexslider in windows 7 and mac which is having firefox 28.0 and it works great, seems like flexslider having issue in windows 8 firefox only. @miketaylr @mattyza , Can you double check with this? |
Hi @miketaylr, I just checked your latest built, its working great in firefox with swipe support in touch devices. Thanks for your work, appreciated! |
Yeah thats correct.
|
Cool, thanks everyone for testing. Would be nice if this got merged... or is this project unmaintained? |
I downloaded and installed the 2.2.2 version of jquery.flexslider.js. This fixed the next, prev, and paging controls, but in Firefox (Mac) 27 and 28 slides are still not transitioning by cross-fading (unless I configure with touch: false). |
@stevenaanen Thank you! I knew the problem had to be with Firefox, not the library or other browsers. |
I solved it copying the code from jQuery FlexSlider v2.2.2: jquery.flexslider-min.js in https://github.com/woothemes/FlexSlider/blob/master/jquery.flexslider-min.js |
…as function expressions. This way they get hoisted properly and we don't rely on undefined behavior (which doesn't work in some browsers).
Strongly recommend to add miketaylr@40b8818. Works for me on Android Tablet using Firefox 31. |
@miketaylr thank you very much for miketaylr@40b8818 It just saved me a great deal of time 😄 |
miketaylr@40b8818 also worked for me on Android mobile running Firefox 31. Thanks! |
thanks Daynos it working for me :) |
It would be nice to get @miketaylr fix into the release code. |
Yeah, can you guys pull this in to master please? Using |
@miketaylr Please update the fix for v2.3.0 |
@pribilinskiy happy to do so. @jeffikus: is there any chance of this getting merged into master? |
I just ran into this on another site in the wild (http://mobile.suntory.co.jp). Let me update my patch against master and update the PR. |
…as function expressions. This way they get hoisted properly and we don't rely on undefined behavior (which doesn't work in some browsers).
…as function expressions. This way they get hoisted properly and we don't rely on undefined behavior (which doesn't work in some browsers).
Just rebased my PR @ #986 against the latest master. |
Fixes #958. Declare onTouchStart, onTouchEnd, onTouchMove as function…
I did a new pull request #1335 for this on release branch 2-5-0 so I can further test this. |
Great! Thanks @jeffikus |
@miketaylr once again I'm really grateful for your pull request and contribution to the project :) super happy when I get stuff like this! 👯 |
* commit '8ed61acca0a1c1f1242ebb0cdb8291be6d4a0d91': Closes woocommerce#843 - adds npm components and package json for registry with npm. Watch for new 2.5.0 tag before using. Closes woocommerce#843 - adds bower components and bower json for registry with bower. Watch for new 2.5.0 tag before using. Closes woocommerce#819 - Adds caption demo file Closes woocommerce#1321 - adds license file GPLv2 and later Merge changes between demo site on svn and git repo. Closes woocommerce#1143 - adds customDirectionNav param, fixes demo's and adds new demo for custom direction navigation controls. Updates changelog and readme. Updates changelog, readme, bumps support for jQuery 1.4.2 to 1.7+ Closes woocommerce#1312 Closes woocommerce#1293 - CSS fix for pausePlay play icon. Working branch pushed to GitHub. Version updated. Fixes woocommerce#958. Declare onTouchStart, onTouchEnd, onTouchMove as function expressions.
Flexslider 2.2.0
After update of FF to Version 26.0 my FlexSlider doesn't work correctly. I get error "ReferenceError: onTouchStart is not defined jquery.flexslider.js:397" with settings
animation: "slide", touch: true
When starting with a half sized browser window and 2 images the first image is scaled down. Everything seems to be OK. But when I enlarge the window to full size I see more than 2 images side by side and they don't react responsive. The clones aren't hidden.
Setting touch:false: works.
With touch:true I changed line 397 of jquery.flexslider.js from
el.addEventListener('touchstart', onTouchStart, false);
to (see lower case):
el.addEventListener('touchstart', ontouchstart, false);
The above mentioned error is gone and after some quick tests it looks like this fix works on FIREFOX (no further testing with other browsers!!).
The text was updated successfully, but these errors were encountered: