Added swipe gesture navigation in archive and post pages. Fixes #39.

This commit is contained in:
Panos Sakkos 2015-11-14 21:24:20 +01:00
parent 91f7b188f6
commit af37115662
5 changed files with 54 additions and 3 deletions

View file

@ -24,7 +24,7 @@ Have you published your own website by forking { Personal } and now you want to
* Blogging functionality
* Preview of the latest post in the home page
* Archive page
* Pagination
* Gesture navigation in archive and post pages by swiping
* #tags
* Disqus comments
* Facebook, Twitter, Reddit, Linked In and Google Plus share buttons

View file

@ -151,4 +151,48 @@ $(window).scroll(toggleNavCollapse);$(function(){$("a.page-scroll").bind("click"
{% endif %}
{% if page.section-type == "post" %}
<!-- Post Gesture Navigation Start -->
<script type="text/javascript" src="{{site.baseurl}}/js/hammer.min.js"></script>
<script>
var post = document.getElementById('post');
new Hammer(post).on('swipeleft', function(event) {
window.location.replace("{{site.baseurl}}{{page.previous.url}}");
});
new Hammer(post).on('swiperight', function(event) {
window.location.replace("{{site.baseurl}}{{page.next.url}}");
});
</script>
<!-- Post Gesture Navigation Start -->
{% endif %}
{% if page.section-type == "blog" %}
<!-- Blog Gesture Navigation Start -->
<script type="text/javascript" src="{{site.baseurl}}/js/hammer.min.js"></script>
<script>
var page = document.getElementById('page');
new Hammer(page).on('swipeleft', function(event) {
window.location.replace("{{site.baseurl}}{{paginator.next_page_path}}");
});
new Hammer(page).on('swiperight', function(event) {
window.location.replace("{{site.baseurl}}{{paginator.previous_page_path}}");
});
</script>
<!-- Blog Gesture Navigation Start -->
{% endif %}
<!-- Javascript End -->

View file

@ -10,7 +10,7 @@
{% include navigation.html %}
<section class="container content-section text-center">
<section id="page" class="container content-section text-center">
<div class="row">
<div class="col-lg-10 col-lg-offset-1">

View file

@ -10,7 +10,7 @@
{% include navigation.html %}
<section class="container content-section text-center">
<section id="post" class="container content-section text-center">
<div class="row">
<div class="col-lg-10 col-lg-offset-1">

7
js/hammer.min.js vendored Normal file

File diff suppressed because one or more lines are too long