JSFiddle - React, Tailwind, and code Playground
by Amar Nyayapati
HTML
<script src="http://192.168.34.53/iPad/Woobme/www/touchSwipe.js"></script>
<div id="cnt">TEST<a style="display:none">DELETE</a></div>
<script>
$(document).ready(function(){
swipeoptions = {
swipeLeft:handleLeftSwipe,
swipeRight:handleRightSwipe,
threshold:50
}
$("#cnt").swipe(swipeoptions);
});
function handleLeftSwipe(obj,dir,dist){
$("#"+obj.target.id).find("a").show();
console.log(obj);
}
function handleRightSwipe(obj,dir,dist){
$("#"+obj.target.id).find("a").hide();
}
</script>
CSS
body{
-webkit-user-select:none;
}
#cnt{
padding:10px;
width:200px;
background:#444444;
height:20px;
color:white
}
a{
color:red;
float:right;
}