]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commit
fix(js): consider 0 value for `pageX`, `pageY` 6025/head
authorAndré Ruffert <andre@andreruffert.com>
Wed, 12 Nov 2014 16:33:10 +0000 (17:33 +0100)
committerAndré Ruffert <andre@andreruffert.com>
Wed, 12 Nov 2014 16:33:10 +0000 (17:33 +0100)
commit61dd6dcce1e92c7184d8f657a9e6d5faefdd37a3
tree922d25c1edaf62f7feba60804cdf47cfc61af4c0
parente24d36b25af2a6b23009439ded14322c5cdd57c6
fix(js): consider 0 value for `pageX`, `pageY`

* remove error message `Uncaught TypeError: Cannot read property '0' of
undefined` if mouse position X/Y is 0
* add `get_cursor_position(e, xy)` method

If you start dragging the slider and move the mouse position X/Y until
it is `0`, it is counted as falsey which means `||` in [line
49](https://github.com/zurb/foundation/blob/master/js/foundation/foundat
ion.slider.js#L49) and in [line
55](https://github.com/zurb/foundation/blob/master/js/foundation/foundat
ion.slider.js#L55) keeps going until it gets to
`e.originalEvent.touches[0].clientX/Y` where it raises an error if it
is no touch device. I changed it to explicitly checking that the values
are `undefined`.
js/foundation/foundation.slider.js