FancyBox displaying contents of a DIV as type iFrame

后端 未结 2 2246
误落风尘
误落风尘 2020-12-03 20:00

This works perfectly fine:



        
相关标签:
2条回答
  • 2020-12-03 20:24

    Do you really expect that <iframe src="#myID"></iframe> would open an element having id myID into iframe?

    If you want to print content of the fancyBox, then you can add print button - http://jsfiddle.net/s3jRA/

    Updated demo - http://jsfiddle.net/qVrLr/ - for creating and updating contents of iframe

    0 讨论(0)
  • 2020-12-03 20:26

    As is often the case, I was looking at things backwards. The solution (with caveats) is this, rather than display a div element using the iframe player, hide an iframe in the html and display it using the inline player.

    See this working example: jsFiddle

    This solves the problem of being able to print dynamic content without opening another window. Additionally if the text overflows the FancyBox, the entire contents are still printed. (That's something I could not get to happen when I printed the FancyBox and changed the various page elements visibility styles to hidden).

    Major Caveats

    I've tested this in IE 8 and it works, however I still cannot get this to work in Chrome.

    One reason for trying this approach was my assumption that I would be able to include within the dyanmic page content an @media print style. That technique does not work (in IE anyway) for some reason. However, inline styles do work as do HTML markup tags (notice the <strong> tag in the jsFiddle example: var myContent). So something is strange.

    0 讨论(0)
提交回复
热议问题