Title: Swipe to next/previous posts
Last modified: August 22, 2016

---

# Swipe to next/previous posts

 *  [destinedjagold](https://wordpress.org/support/users/destinedjagold/)
 * (@destinedjagold)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/swipe-to-nextprevious-posts/)
 * Hello and good day everyone.
    I am working on a WordPress blog. The PC version
   is almost complete (just waiting for the list of bugs to fix), so I moved on 
   to ‘mobilizing’ it, creating a new, separate theme for the mobile/android/iPad/
   whatever. So my site has two themes, PC and mobile.
 * In this new mobile theme, I want to add this swiping feature while on the post
   page. If I swipe left/right, then I’ll be brought to the previous/next post (
   if there are any).
 * I’ve looked and searched through Google and tried these Javascript and jQuery
   methods, but none of them seemed to work.
 * So I wanna ask you guys if you know of any ways for me to add this feature.
 * Thanks and good day~

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [tormorten](https://wordpress.org/support/users/tormorten/)
 * (@tormorten)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/swipe-to-nextprevious-posts/#post-5691762)
 * I’ve used the [TouchSwipe](http://www.awwwards.com/touchswipe-a-jquery-plugin-for-touch-and-gesture-based-interaction.html)
   library on several occations for this kind of stuff.
 * Have you checked it out?
 *  Thread Starter [destinedjagold](https://wordpress.org/support/users/destinedjagold/)
 * (@destinedjagold)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/swipe-to-nextprevious-posts/#post-5691842)
 * Thank you for sharing. This one looks really promising. ^^
 * Just for clarification, I only need to put the following files inside my [js]
   folder and call these files in my header for this to work, right?
    – jquery.touchSwipe.
   js – jquery.touchSwipe.min.js
 * I’ve checked the demo pages that was included in the download, so I’m uncertain
   if those two files are the only ones I need to add, or do I also need to add 
   this in my header…
    – <script type=”text/javascript” src=”[https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js”></script&gt](https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js”></script&gt);
 * Thanks and good day~
 *  Thread Starter [destinedjagold](https://wordpress.org/support/users/destinedjagold/)
 * (@destinedjagold)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/swipe-to-nextprevious-posts/#post-5691851)
 * Well, after testing on a test html, it seems that I only need the [jquery.touchSwipe.
   min.js] file, plus I also need to add this in my header.
    – <script type=”text/
   javascript” src=”[https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js”></script&gt](https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js”></script&gt);
 * I’m going to test this on my actual site now. ^^
 *  Thread Starter [destinedjagold](https://wordpress.org/support/users/destinedjagold/)
 * (@destinedjagold)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/swipe-to-nextprevious-posts/#post-5691865)
 * Well, after hours of testing, I wasn’t able to make it work on my actual site.:/
   
   Here’s a skeletal html structure of the site where I tested it on…
 *     ```
       <html><head>
       ...
       <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
       <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/jquery.touchSwipe.min.js"></script>
   
       <?php wp_head(); ?>
       ...
       </head>
       <body>
       ...
   
       <div class="test_area" style="padding-bottom: 10px;">
       	Testing
       	<p id="test_p"></p>
       </div>
   
       <script>
       $(function() {
       	$(".test_area").swipe( {
       		swipeLeft:function(event, direction, distance, duration,) {
       			$("#test_p").text("You swiped " + direction );
       		},
       		swipeRight:function(event, direction, distance, duration,) {
       			$("#test_p").text("You swiped " + direction );
       		},
   
       		threshold:0
       	});
       });
       </script>
       ...
       </body></html>
       ```
   
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/swipe-to-nextprevious-posts/#post-5691881)
 * You’ve fallen into the WP jQuery trap. Don’t feel bad, many hundreds have preceded
   you. Don’t load an external jQuery, WP has its own version which causes conflicts.
   You also need to enqueue your touchswipe script, specifying the local jquery 
   as a dependency. This is all explained in [Function Reference/wp enqueue script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)
 *  Thread Starter [destinedjagold](https://wordpress.org/support/users/destinedjagold/)
 * (@destinedjagold)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/swipe-to-nextprevious-posts/#post-5691897)
 * Thank you for sharing!
    I’m going to study this for a while then and hope I can
   fix this little issue of mine.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Swipe to next/previous posts’ is closed to new replies.

## Tags

 * [Gesture](https://wordpress.org/support/topic-tag/gesture/)
 * [next](https://wordpress.org/support/topic-tag/next/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [previous](https://wordpress.org/support/topic-tag/previous/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 6 replies
 * 3 participants
 * Last reply from: [destinedjagold](https://wordpress.org/support/users/destinedjagold/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/swipe-to-nextprevious-posts/#post-5691897)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
