制作灯箱支持在网页上打印 [英] Making a lightbox support printing on web page

查看:160
本文介绍了制作灯箱支持在网页上打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个想法是使用单独的样式表打印,当用户点击lightbox上的打印按钮时,它会隐藏除灯箱之外的一切。

I know the idea is to use a separate stylesheet for printing that hides everything other than the lightbox when the user clicks the print button on the lightbox.

容易,但总是有一些障碍。所以我想知道是否有任何支持所有主流浏览器的工作示例。

It sounds easy but there are always some obstacles. So I would like to know if there is any working example that supports all major browsers.

我在google中搜索了很多lightbox,但是没有一个打印按钮-in。

I searched in google and found many lightbox but none of them has a print button built-in.

推荐答案

我建议你看看这篇文章 http://www.bennadel.com/blog/1591-Ask -Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm

I suggest you take a look at this article http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm

它通过临时创建iframe来工作,被用户看到,并迅速把所有的东西打印进去(例如只是一个div和它的内容)。然后打印iframe的内容。

It works by temporarily creating an iframe, which can not be seen by the user, and quickly put all stuff to print into it (for example just a div and its contents). Then the content of the iframe is printed.

顺便说一下,stylesheet方法可能被认为是走路,但有一些跨浏览器问题,根据我的经验。

By the way, the stylesheet-method maybe considered as "way to go" but has a couple of cross-browser issues, from my experience.

编辑:实际上,这看起来像你正在搜索 http://plugins.jquery.com/project/jqPrint

edit: actually, this looks like what you are searching for http://plugins.jquery.com/project/jqPrint

这篇关于制作灯箱支持在网页上打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆