Revert "Merge pull request #318 from matthojo/mobile-interactions"

This reverts commit 143b1d56eaf9b6f27671278a85904604c4076d7d, reversing
changes made to 9d97a8930a6b2d2b9aaa579ada21a7509120b693.
This commit is contained in:
Hannah Wolfe 2013-08-01 22:19:20 +01:00
parent c671081c2f
commit e219090fc3
5 changed files with 16 additions and 84 deletions

View File

@ -5,7 +5,7 @@
(function () {
"use strict";
// ## UTILS
// UTILS
/**
* Allows to check contents of each element exactly
@ -80,66 +80,6 @@
return this;
};
// ## GLOBALS
/**
* Hammer.js
*/
var Hammer = $(document).hammer({stop_browser_behavior: { touchAction: true }});
Hammer.on("swiperight", "#global-header", function (event) {
if (window.matchMedia('(max-width: 400px)').matches) {
event.gesture.preventDefault();
$('body').addClass('off-canvas');
}
});
Hammer.on("swipeleft", "#main-menu", function (event) {
if (window.matchMedia('(max-width: 400px)').matches) {
event.gesture.preventDefault();
$('body').removeClass('off-canvas');
}
});
Hammer.on("tap swipeleft", ".manage .content-list ol li", function (event) {
if (window.matchMedia('(max-width: 800px)').matches) {
event.gesture.preventDefault();
$(".content-list").animate({right: "100%", left: "-100%", 'margin-right': "15px"}, 300);
$(".content-preview").animate({right: "0", left: "0", 'margin-left': "0"}, 300);
}
});
Hammer.on("swiperight", ".content-preview", function (event) {
if (window.matchMedia('(max-width: 800px)').matches) {
event.gesture.preventDefault();
$(".content-list").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
$(".content-preview").animate({right: "-100%", left: "100%", 'margin-left': "15px"}, 300);
}
});
Hammer.on("tap swipeleft", ".settings .settings-menu li", function (event) {
if (window.matchMedia('(max-width: 800px)').matches) {
event.gesture.preventDefault();
$(".settings-sidebar").animate({right: "100%", left: "-102%", 'margin-right': "15px"}, 300);
$(".settings-content").animate({right: "0", left: "0", 'margin-left': "0"}, 300);
}
});
Hammer.on("swiperight", ".settings-content", function (event) {
if (window.matchMedia('(max-width: 800px)').matches) {
event.gesture.preventDefault();
$(".settings-sidebar").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
$(".settings-content").animate({right: "-100%", left: "100%", 'margin-left': "15px"}, 300);
}
});
$('[data-off-canvas]').on('click', function (e) {
if (window.matchMedia('(max-width: 650px)').matches) {
e.preventDefault();
$('body').toggleClass('off-canvas');
}
});
$('.overlay').hideAway();
$('.overlay').hideAway(); // TODO: Move to a more sensible global file.
}());

View File

@ -32,6 +32,9 @@
background: #fff;
box-shadow: $shadow;
@include breakpoint(900px) {
width:300px;
}
@include breakpoint($tablet) {
width:auto;
right:0;
@ -179,11 +182,9 @@
border-left:$lightbrown 2px solid;
background: #fff;
box-shadow: $shadow;
@include breakpoint($tablet) {
@include breakpoint(900px) {
width: auto;
left: 100%;
right: -100%;
margin-left: 15px;
left: 300px;
}
.unfeatured {

View File

@ -48,7 +48,6 @@
left:0;
bottom:0;
z-index: 700;
background: #FFFFFF;
box-shadow: $lightbrown 1px 0 0;
@include breakpoint($tablet) {
width:100%;
@ -158,15 +157,7 @@
right:0;
left:20%;
bottom:0;
background: #FFFFFF;
@include breakpoint($tablet) {
display: none;
width: 100%;
left: 100%;
right: -100%;
margin-left: 15px;
}
@include breakpoint($tablet) { display: none; }
display: none;
&.active {display:block;}

File diff suppressed because one or more lines are too long

View File

@ -162,6 +162,13 @@
$(e.currentTarget).remove();
}
function handleClickOff(e) {
if (window.matchMedia('(max-width: 650px)').matches) {
e.preventDefault();
$('body').toggleClass('off-canvas');
}
}
$(document).ready(function () {
suggestions = $("ul.suggestions").hide(); // Initnialise suggestions overlay
@ -175,7 +182,7 @@
.on('keydown', handleTagKeyDown);
$('ul.suggestions').on('click', "li", handleSuggestionClick);
$('.categories').on('click', ".category", handleCategoryClick);
$('[data-off-canvas]').on('click', handleClickOff);
});
}());