Added swipe gesture navigation in archive and post pages. Fixes #39.
This commit is contained in:
parent
91f7b188f6
commit
af37115662
5 changed files with 54 additions and 3 deletions
|
|
@ -24,7 +24,7 @@ Have you published your own website by forking { Personal } and now you want to
|
||||||
* Blogging functionality
|
* Blogging functionality
|
||||||
* Preview of the latest post in the home page
|
* Preview of the latest post in the home page
|
||||||
* Archive page
|
* Archive page
|
||||||
* Pagination
|
* Gesture navigation in archive and post pages by swiping
|
||||||
* #tags
|
* #tags
|
||||||
* Disqus comments
|
* Disqus comments
|
||||||
* Facebook, Twitter, Reddit, Linked In and Google Plus share buttons
|
* Facebook, Twitter, Reddit, Linked In and Google Plus share buttons
|
||||||
|
|
|
||||||
|
|
@ -151,4 +151,48 @@ $(window).scroll(toggleNavCollapse);$(function(){$("a.page-scroll").bind("click"
|
||||||
|
|
||||||
{% endif %}
|
{% 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 -->
|
<!-- Javascript End -->
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
{% include navigation.html %}
|
{% include navigation.html %}
|
||||||
|
|
||||||
<section class="container content-section text-center">
|
<section id="page" class="container content-section text-center">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-10 col-lg-offset-1">
|
<div class="col-lg-10 col-lg-offset-1">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
{% include navigation.html %}
|
{% include navigation.html %}
|
||||||
|
|
||||||
<section class="container content-section text-center">
|
<section id="post" class="container content-section text-center">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-10 col-lg-offset-1">
|
<div class="col-lg-10 col-lg-offset-1">
|
||||||
|
|
||||||
|
|
|
||||||
7
js/hammer.min.js
vendored
Normal file
7
js/hammer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue