Swipeout
Swipe-to-delete goodness for the mobile web
Install / Use
/learn @ankane/SwipeoutREADME
SwipeOut
:surfer: Swipe-to-delete goodness for the mobile web
:tangerine: Battle-tested at Instacart
Usage
It’s easy to get started
Instantiate SwipeOut on a <ul> or <ol> element.
var list = document.getElementById("list");
new SwipeOut(list);
When an item is deleted, a delete event is fired.
Javascript
list.addEventListener("delete", function(evt) {
// do something, like an ajax call to server
// evt.target references the list item
});
jQuery or Zepto
$("#list li").on("delete", function(evt) {
// ...
});
Install
SwipeOut requires Hammer.js. Include the following two files on your website:
Just over 3kb total when minified and gzipped
<script src="path/to/hammer.js"></script>
<script src="path/to/swipeout.js"></script>
Customize
The delete button is unstyled by default. Give it a custom style, like an iOS theme:
.swipe-out .delete-btn {
padding: 6px 8px;
border-radius: 6px;
border: solid 1px rgb(96,23,18);
background-image: linear-gradient(top, rgb(242,153,157), rgb(213,62,41));
background-image: -webkit-linear-gradient(top, rgb(242,153,157), rgb(213,62,41));
background-image: -moz-linear-gradient(top, rgb(242,153,157), rgb(213,62,41));
background-image: -o-linear-gradient(top, rgb(242,153,157), rgb(213,62,41));
text-shadow: 0em -0.1em rgb(51,51,51);
color: #fff;
font: bold 14px/20px "Helvetica Neue", Arial, Helvetica, sans-serif;
}
The delete button text can be set with:
new SwipeOut(list, {btnText: "Remove"}); // default: "Delete"
Related Skills
node-connect
334.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
334.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.3kCommit, push, and open a PR
