jQuery/jQuery mobile tap/swipe event
Hi im trying call this function from an element, but the element id is dynamic.
<script>
$(function() {
$('#showme_').live('swiperight',function(event) {
$("#showDel_").show();
});
</script>
if a user swipes on an element is shows the delete button.
<div id="swipeme_1"开发者_C百科>swipe me
<div id="showDel_1" style="display:none;">DELETE</div>
</div>
<div id="swipeme_2">swipe me
<div id="showDel_2" style="display:none;">DELETE</div>
</div>
<div id="swipeme_2">swipe me
<div id="showDel_3" style="display:none;">DELETE</div>
</div>
i can achieve the same effect by looping the javascript in with the backend code of the site. is there another/easier way?
Regards
I dont know which plugin you are using for swiperlight
event. But if you are not using touchwipe
plugin then I would suggest you to take a look at this
http://www.netcu.de/jquery-touchwipe-iphone-ipad-library
Sample code
$("#showme_").touchwipe({
wipeLeft: function() { alert("left"); },
wipeRight: function() { alert("right"); },
wipeUp: function() { alert("up"); },
wipeDown: function() { alert("down"); }
preventDefaultEvents: true
});
精彩评论