Slide leaflet controls with panels
This commit is contained in:
@@ -206,23 +206,41 @@ function initPage(asHash) {
|
||||
//Add "Loading" Post
|
||||
getPost({type: 'loading', headerless: true, formatted_time: '', relative_time: ''}).appendTo($('#loading'));
|
||||
|
||||
//Mobile events
|
||||
//Mobile Touchscreen Events
|
||||
self.tmp('$Feed').onSwipe(
|
||||
(oPos) => {
|
||||
self.tmp('$Feed').css('right', Math.min(oPos.xStart - oPos.xMove, 0)+'px');
|
||||
this.$Panels = $('.leaflet-right').add(self.tmp('$Feed')).each(function() {
|
||||
$(this).data('initial-offset', parseInt($(this).css('right')));
|
||||
});
|
||||
},
|
||||
(oPos) => {
|
||||
this.$Panels.each(function(){
|
||||
$(this).css({'right': ($(this).data('initial-offset') + Math.min(oPos.xStart - oPos.xMove, 0))+'px', 'transition': 'none'});
|
||||
});
|
||||
},
|
||||
(oPos) => {
|
||||
if(oPos.xEnd - oPos.xStart > 100 && Math.abs(oPos.yEnd - oPos.yStart) < 100) toggleFeedPanel(false);
|
||||
self.tmp('$Feed').css('right', '');
|
||||
this.$Panels.each(function(){
|
||||
$(this).css({'right': '', 'transition': ''});
|
||||
});
|
||||
}
|
||||
);
|
||||
self.tmp('$Settings').onSwipe(
|
||||
(oPos) => {
|
||||
self.tmp('$Settings').css('left', Math.min(oPos.xMove - oPos.xStart, 0)+'px');
|
||||
this.$Panels = $('.leaflet-left').add(self.tmp('$Settings')).each(function() {
|
||||
$(this).data('initial-offset', parseInt($(this).css('left')));
|
||||
});
|
||||
},
|
||||
(oPos) => {
|
||||
this.$Panels.each(function(){
|
||||
$(this).css({'left': ($(this).data('initial-offset') + Math.min(oPos.xMove - oPos.xStart, 0))+'px', 'transition': 'none'});
|
||||
});
|
||||
},
|
||||
(oPos) => {
|
||||
if(oPos.xEnd - oPos.xStart < -100 && Math.abs(oPos.yEnd - oPos.yStart) < 100) toggleSettingsPanel(false);
|
||||
self.tmp('$Settings').css('left', '');
|
||||
this.$Panels.each(function(){
|
||||
$(this).css({'left': '', 'transition': ''});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user