Swipeout

Note! Swipeout is not complete tested in Android, and there is a known bug in some Android: Swipeout element may flicker when page scroll.

You must include these to file after light7.js and light7.css to use Swipeout:

{% highlight html %} {% endhighlight %}

Swipeout is an extension of list view that allows you to swipe over list elements to reveal hidden menu with available actions, like swipe-to-delete.

Let's look on layout structure of swipeout element in your list views:

{% highlight html %}
{% endhighlight %}

Where:

Close And Delete

Add .swipeout-close to action link to close swipeout.

Add .swipeout-delete to action link to close swipeout. You can also add data-confirm="confirm message" and data-confirm-title="confirm title" to show a confirm dialog when user click the delete button.

{% highlight html %}
  • Swipe me left!
    666
  • Remove me after confirm!
  • {% endhighlight %}

    JavaScript

    Swipeouts also has rich JavaScript API that allows you to control swipeout elements. Let's look on appropriate App's properties and methods:

    $.swipeoutOpen(el, direction, callback) - reveal swipeout actions on specified element

    $.swipeoutClose(el, callback) - close swipeout actions on specified element

    $.swipeoutDelete(el, callback) - delete specified swipeout element

    Swipeout Events

    Swipeout elements have the following events:

    Event Target Description
    swipeout Swipeout Element<li class="swipeout"> Event will be triggered while you move swipeout element. event.detail.progress contains current opened progress percentage
    open Swipeout Element<li class="swipeout"> Event will be triggered when swipeout element starts its opening animation
    opened Swipeout Element<li class="swipeout"> Event will be triggered after swipeout element completes its opening animation
    close Swipeout Element<li class="swipeout"> Event will be triggered when swipeout element starts its closing animation
    closed Swipeout Element<li class="swipeout"> Event will be triggered after swipeout element completes its closing animation
    delete Swipeout Element<li class="swipeout"> Event will be triggered after swipeout element starts its delete animation
    deleted Swipeout Element<li class="swipeout"> Event will be triggered after swipeout element completes its delete animation right before it will be removed from DOM
    {% highlight js %} $('.swipeout').on('swipeout', function (e) { console.log('Item opened on: ' + e.detail.progress + '%'); }); {% endhighlight %}