mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
Removed swiping from Mobile Interactions
This commit is contained in:
parent
06aed8786a
commit
31b94e23a3
@ -12,26 +12,8 @@
|
|||||||
// `drag: false` Removes the Hammer drag event listeners, as they were clashing with jQueryUI Draggable
|
// `drag: false` Removes the Hammer drag event listeners, as they were clashing with jQueryUI Draggable
|
||||||
var Hammer = $(document).hammer({stop_browser_behavior: { touchAction: true }, drag: false});
|
var Hammer = $(document).hammer({stop_browser_behavior: { touchAction: true }, drag: false});
|
||||||
|
|
||||||
// ### Show left menu sidebar on right swipe
|
|
||||||
Hammer.on("swiperight", "#global-header", function (event) {
|
|
||||||
if (window.matchMedia('(max-width: 650px)').matches) {
|
|
||||||
event.gesture.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
$('body').addClass('off-canvas');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ### Hide left menu sidebar on swipe left
|
|
||||||
Hammer.on("swipeleft", "#main-menu", function (event) {
|
|
||||||
if (window.matchMedia('(max-width: 650px)').matches) {
|
|
||||||
event.gesture.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
$('body').removeClass('off-canvas');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ### Show content preview when swiping left on content list
|
// ### Show content preview when swiping left on content list
|
||||||
Hammer.on("tap swipeleft", ".manage .content-list ol li", function (event) {
|
Hammer.on("tap", ".manage .content-list ol li", function (event) {
|
||||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||||
event.gesture.preventDefault();
|
event.gesture.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@ -40,19 +22,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ### Show content list when swiping right on preview
|
|
||||||
Hammer.on("swiperight", ".content-preview", function (event) {
|
|
||||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
|
||||||
event.gesture.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
$(".content-list").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
|
|
||||||
$(".content-preview").animate({right: "-100%", left: "100%", 'margin-left': "15px"}, 300);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ### Show settings options page when swiping left on settings menu link
|
// ### Show settings options page when swiping left on settings menu link
|
||||||
Hammer.on("tap swipeleft", ".settings .settings-menu li", function (event) {
|
Hammer.on("tap", ".settings .settings-menu li", function (event) {
|
||||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
if (window.matchMedia('(max-width: 800px)').matches) {
|
||||||
event.gesture.preventDefault();
|
event.gesture.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@ -61,16 +32,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ### Show settings menu when swiping right on settings options page
|
|
||||||
Hammer.on("swiperight", ".settings-content", function (event) {
|
|
||||||
if (window.matchMedia('(max-width: 800px)').matches) {
|
|
||||||
event.gesture.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
$(".settings-sidebar").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
|
|
||||||
$(".settings-content").animate({right: "-100%", left: "100%", 'margin-left': "15px"}, 300);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// ### Toggle the sidebar menu
|
// ### Toggle the sidebar menu
|
||||||
$('[data-off-canvas]').on('click', function (e) {
|
$('[data-off-canvas]').on('click', function (e) {
|
||||||
if (window.matchMedia('(max-width: 650px)').matches) {
|
if (window.matchMedia('(max-width: 650px)').matches) {
|
||||||
|
Loading…
Reference in New Issue
Block a user