Trigger resize event on print

前端 未结 2 1954
借酒劲吻你
借酒劲吻你 2021-01-04 07:50

I have a div in which I create a chart using protovis. The div has width: 100% and height: 100% and the code to create the chart uses $(\'#c

2条回答
  •  一生所求
    2021-01-04 08:22

    Rather than mutating the chart properties with an event, the @media print css rule might help here. https://developer.mozilla.org/en-US/docs/Web/CSS/%40media

    @media print{
      #chart { width: 100%; height: 98%; background: gray; border: 1px solid black;}
    }
    

    With this method, these style properties are applied on print, regardless what other changes you've made.

提交回复
热议问题