-
-
Notifications
You must be signed in to change notification settings - Fork 453
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
support css var change by javascript #153
base: master
Are you sure you want to change the base?
Conversation
Feels like an edge case, but low risk. Will look into it. |
I am not going to merge this at this time, as we have the |
I don't think you can use |
@eakkew What I'm referencing is that rather than inlining styles, use classes on the html or body element (which can also be changed dynamically). |
I knew we can change css classes dynamicly. however, in my case my users are able to config things. I think creating all possible classes is not a best solution. |
I agree with @eakkew. If setting CSS variables dynamically (in my case, so that the arrangement of rows and columns in a CSS grid match those of a 2D javascript array), the variables do not get passed. This means that my CSS grid items are condensed into a single column, rendering my print useless. Is there a workaround for this, please? |
I'm reopening this and looking to add this functionality behind a flag, disabled by default to maintain backward compatibility. In the short-term, @robcowen If you use the Something like (this is untested): var $foo = $('.myPrint');
$foo.printThis({beforePrint: function() {
$foo.prop('style', $('html').get(0).style.cssText);
}}); |
@robcowen By setting |
I've modified my code to use a different method of printing now, so I can't test it properly. However, setting |
if you use css variable and change them with js, e.g.
document.documentElement.style.setProperty("--foo", bar);
, it wont include when we print. So, i add a line to copy inline style from html tag to html tag inside iframe