diff --git a/smash/web/static/js/daily_planning.js b/smash/web/static/js/daily_planning.js index ffee4f8894433a1d60375cb45512b2912ecaabb5..1f8265a095241a09db9545ac11048d80f4809320 100644 --- a/smash/web/static/js/daily_planning.js +++ b/smash/web/static/js/daily_planning.js @@ -408,6 +408,10 @@ $(document).ready(function () { $(this).remove(); }, eventAfterAllRender: function(view){ + //RESIZE COLUMNS AND ENABLE HORIZONTAL SCROLL + window.onresize = function(event) { + resizeCalendarColumns(); + }; //ADD EDIT BUTTONS $('.fc-resource-cell').not('.anchored').each(function(resourceColumn){ @@ -427,4 +431,16 @@ $(document).ready(function () { } }); }) -; \ No newline at end of file +; + +//RESIZE COLUMNS AND ENABLE HORIZONTAL SCROLL +function resizeCalendarColumns(){ + if($('.fc-resource-cell').width() <= 150){ + $('.fc-view-container').width(200*$('.fc-resource-cell').length); + $('#calendar').css('overflow-x', 'scroll'); + } + if($('#calendar').width() > 200*$('.fc-resource-cell').length){ + $('.fc-view-container').width("100%"); + $('#calendar').css('overflow-x', 'null'); + } +}