pixeloftdev
pixeloftdev

Reputation: 247

Jquery swipe to refresh mobile web page

I want to refresh a mobile web page on-swipe. The html code is very basic, and just need the necessary jquery/javascript to get the swipe to reload the current page.

Here is the HTML: http://jsfiddle.net/yKpLJ/1/ I am pulling in jquery and jquery ui as well, but don't know how to move forward.

    <div id="fact-footer">
        <ul>
            <li class="share facebook">
                <a href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]=&p[images][0]=&p[title]=&p[summary]=" target="_blank" title="">Share It</a>
            </li>
            <li class="share twitter">
                <a href="http://twitter.com/home?status=" target="_blank" title="">Tweet It</a>
            </li>
            <li class="refresh">
                <a href="." title="Fact">Refresh Fact</a>
            </li>
            <li class="logo">
                <a href="" target="_blank" title="">Logo</a>
            </li>
        </ul>
    </div>

Thanks!

Upvotes: 1

Views: 2410

Answers (1)

Lee Bailey
Lee Bailey

Reputation: 3624

Check out HammerJS http://eightmedia.github.io/hammer.js/

Include the script on your page and then do something like this:

var element = $('body');

Hammer(element).on("swipeleft", function() {
    location.reload();
}); 

Upvotes: 5

Related Questions