Created
October 26, 2019 18:41
-
-
Save innocenzi/60e0d3a3d0706811487408cff3312d36 to your computer and use it in GitHub Desktop.
Tailwind touch-actions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.touch-none { | |
touch-action: none; | |
} | |
.touch-auto { | |
touch-action: auto; | |
} | |
.touch-pan-x { | |
touch-action: pan-x; | |
} | |
.touch-pan-left { | |
touch-action: pan-left; | |
} | |
.touch-pan-right { | |
touch-action: pan-right; | |
} | |
.touch-pan-y { | |
touch-action: pan-y; | |
} | |
.touch-pan-up { | |
touch-action: pan-up; | |
} | |
.touch-pan-down { | |
touch-action: pan-down; | |
} | |
.touch-pinch-zoom { | |
touch-action: pinch-zoom; | |
} | |
.touch-manipulation { | |
touch-action: manipulation; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function({ addUtilities, variants }) { | |
const actions = [ 'none', 'auto', 'pan-x', 'pan-left', 'pan-right', 'pan-y', 'pan-up', 'pan-down', 'pinch-zoom', 'manipulation' ]; | |
const utilities = _.map(actions, action => ({ | |
[`.touch-${action}`]: { | |
'touch-action': action | |
} | |
})); | |
addUtilities(utilities, variants('touchActions'), | |
); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment