Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CSS rule so that out.width can be applied on a chunk #458

Merged
merged 3 commits into from
May 11, 2022
Merged

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented May 11, 2022

fix #286. This seems possible as width is also set / unset in JS for knitr plot output

$('.layout-chunk').each(function(i, val) {
var figures = $(this).find('img, .html-widget');
// ignore leaflet img layers (#106)
figures = figures.filter(':not(img[class*="leaflet"])')
if ($(this).attr('data-layout') !== "l-body") {
figures.css('width', '100%');
} else {
figures.css('max-width', '100%');
figures.filter("[width]").each(function(i, val) {
var fig = $(this);
fig.css('width', fig.attr('width') + 'px');
});

This way the CSS rule would not take precedence over a CSS style value set on image using out.width

@cderv cderv changed the title Remove CSS rule to so that out.width can be applied. Remove CSS rule so that out.width can be applied on a chunk May 11, 2022
@cderv cderv merged commit 84e21e9 into main May 11, 2022
@cderv cderv deleted the fig-100pct branch May 11, 2022 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

For include_graphics, out.width ignored when fig.cap is set
1 participant