diff options
Diffstat (limited to 'view/theme/redbasic/js/redbasic.js')
-rw-r--r-- | view/theme/redbasic/js/redbasic.js | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 999b46268..e31458b4e 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -8,7 +8,7 @@ $(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%' ); } @@ -16,9 +16,25 @@ $(document).ready(function() { } $('#css3-calc').remove(); // Remove the test element - $('#expand-aside').click(function() { - $('#expand-aside-icon').toggleClass('fa-arrow-circle-right').toggleClass('fa-arrow-circle-left'); - $('main').toggleClass('region_1-on'); + if($(window).width() > 767) { + $('#left_aside_wrapper').stick_in_parent({ + offset_top: $('nav').outerHeight(true) + }); + } + + $('#expand-aside').on('click', toggleAside); + + $('section').on('click', function() { + if($('main').hasClass('region_1-on')){ + toggleAside(); + } + }); + + $(window).on('scroll', function() { + if($('main').hasClass('region_1-on') && $(window).scrollLeft() > 5){ + $(window).scrollLeft(0); + toggleAside(); + } }); if($('aside').length && $('aside').html().length === 0) { @@ -32,6 +48,12 @@ $(document).ready(function() { $('#expand-tabs-icon').toggleClass('fa-arrow-circle-down').toggleClass('fa-arrow-circle-up'); }); + $('.usermenu-head').click(function() { + if($('#navbar-collapse-1').hasClass('in')){ + $('#navbar-collapse-1').removeClass('in'); + } + }); + if($('#tabs-collapse-1').length === 0) { $('#expand-tabs').hide(); } @@ -66,5 +88,22 @@ function makeFullScreen(full) { $('#tabs-collapse-1').css({'visibility': ''}); $('#inline-btn').hide(); $('main').css({'transition': ''}); + $(document.body).trigger("sticky_kit:recalc"); + } +} + +function toggleAside() { + $('#expand-aside-icon').toggleClass('fa-arrow-circle-right').toggleClass('fa-arrow-circle-left'); + if($('main').hasClass('region_1-on')){ + $('main').removeClass('region_1-on') + $('#overlay').remove(); + $('#left_aside_wrapper').trigger("sticky_kit:detach"); + } + else { + $('main').addClass('region_1-on') + $('<div id="overlay"></div>').appendTo('section'); + $('#left_aside_wrapper').stick_in_parent({ + offset_top: $('nav').outerHeight(true) + }); } } |