• Redirect on swipe with hammer.js

    291 Views Asked by At

    I need a help. I have a two links in ul.

    <ul class="group switcher">
        <li><a href="/" id="next"><i class="fa fa-list-ul" aria-hidden="true"></i></a></li>
        <li><a href="news-table.html" id="previous"><i class="fa fa-th-large" aria-hidden="true"></i></a></li>
    </ul>
    

    When I swipe to right #nextI want redirect to news-table.html. I use Hammer.js. Thank you!

    1

    There are 1 best solutions below

    3
    Argee On
    var options = { /* your options*/};
    
    $('#next').hammer(options).bind("swiperight", function() {
        var href = $(this).attr('href');
        $(window).location.replace(href);
    });
    

    only answered by reading the documentation. might need some adjustments in your code...