Open a new javascript window(.open) along with its CSS styling

后端 未结 6 490
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 18:50

I\'m trying to get this function to work on the website of a project I\'m working on. The purpose of this function is to only (physically) print the contents of a child div

6条回答
  •  清酒与你
    2020-11-27 18:56

    I had the same issue. What I am finding is that it is printing before the css has time to render on the page. What I did to find this was do a setTimeout on the print call and all styling was then showing up in the printed document. If I did not do the timeout I found that the styling was not being picked up in the print call.

提交回复
热议问题