aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/redbasic/js/redbasic.js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-12-19 12:46:36 +0100
committerMario Vavti <mario@mariovavti.com>2016-12-19 12:46:36 +0100
commit3ad3d3037f8ba9643952bbf64e70c5edf302a73b (patch)
treeffd19cdee219754ce25486b9e28e9829a049b243 /view/theme/redbasic/js/redbasic.js
parent9c5f2de4ec28ad3878fc565485d8d544caa8c66a (diff)
downloadvolse-hubzilla-3ad3d3037f8ba9643952bbf64e70c5edf302a73b.tar.gz
volse-hubzilla-3ad3d3037f8ba9643952bbf64e70c5edf302a73b.tar.bz2
volse-hubzilla-3ad3d3037f8ba9643952bbf64e70c5edf302a73b.zip
make sticky aside available for small screens. we had to get rid of the transition effect for this to work reliably
Diffstat (limited to 'view/theme/redbasic/js/redbasic.js')
-rw-r--r--view/theme/redbasic/js/redbasic.js38
1 files changed, 21 insertions, 17 deletions
diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js
index 8fb1117ce..4a18db8ff 100644
--- a/view/theme/redbasic/js/redbasic.js
+++ b/view/theme/redbasic/js/redbasic.js
@@ -8,34 +8,32 @@ $(document).ready(function() {
if( $('#css3-calc').width() == 10) {
$(window).resize(function() {
if($(window).width() < 767) {
- $('main').css('width', $(window).width() + 287 );
+ $('main').css('width', $(window).width() + $('aside').outerWidth() );
} else {
$('main').css('width', '100%' );
}
});
}
+
$('#css3-calc').remove(); // Remove the test element
- if($(window).outerWidth() > 767) {
- $('#left_aside_wrapper').stick_in_parent({
- offset_top: $('nav').outerHeight(true)
- });
- }
+ $('#left_aside_wrapper').stick_in_parent({
+ offset_top: $('nav').outerHeight(true)
+ });
- $(window).resize(function() {
- if($(window).outerWidth() > 767) {
- $('#left_aside_wrapper').stick_in_parent({
- offset_top: $('nav').outerHeight(true)
- });
- }
- else {
- $('#left_aside_wrapper').trigger("sticky_kit:detach");
+ $('#expand-aside').on('click', toggleAside);
+
+ $('section').on('click', function() {
+ if($('main').hasClass('region_1-on')){
+ toggleAside();
}
});
- $('#expand-aside').click(function() {
- $('#expand-aside-icon').toggleClass('fa-arrow-circle-right').toggleClass('fa-arrow-circle-left');
- $('main').toggleClass('region_1-on');
+ $(window).on('scroll', function() {
+ if($('main').hasClass('region_1-on') && $(window).scrollLeft() > 5){
+ $(window).scrollLeft(0);
+ toggleAside();
+ }
});
if($('aside').length && $('aside').html().length === 0) {
@@ -92,3 +90,9 @@ function makeFullScreen(full) {
$(document.body).trigger("sticky_kit:recalc");
}
}
+
+function toggleAside() {
+ $(window).scroll();
+ $('#expand-aside-icon').toggleClass('fa-arrow-circle-right').toggleClass('fa-arrow-circle-left');
+ $('main').toggleClass('region_1-on');
+}