Skip to content

Commit 02207b7

Browse files
authored
Fix detach call and Fix css height when not reloading on resize (#269)
1 parent 2de4edd commit 02207b7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

inst/rmarkdown/templates/flex_dashboard/resources/flexdashboard.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ var FlexDashboard = (function () {
149149
window.location.reload();
150150
}
151151
});
152+
} else {
153+
// if in desktop mode and resizing to mobile, make sure the heights are 100%
154+
// This enforces what `fillpage.css` does for "wider" pages.
155+
// Since we are not reloading once the page becomes small, we need to force the height to 100%
156+
// This is a new situation introduced when `_options.resize_reload` is `false`
157+
if (! _options.isMobile) {
158+
// only add if `fillpage.css` was added in the first place
159+
if (_options.fillPage) {
160+
// fillpage.css
161+
$("html,body,#dashboard").css("height", "100%");
162+
}
163+
}
152164
}
153165
// trigger layoutcomplete event
154166
dashboardContainer.trigger('flexdashboard:layoutcomplete');
@@ -404,7 +416,7 @@ var FlexDashboard = (function () {
404416
var h3 = $('<h3></h3>');
405417
h3.append(h2.contents());
406418
h3.insertBefore(h2);
407-
h2.detatch();
419+
h2.detach();
408420

409421
// wipeout h2 elements then enclose them in a single h2
410422
var level2 = page.find('div.section.level2');

0 commit comments

Comments
 (0)