DoersGuild/jQuery.print
Fork: 458 Star: 840 (更新于 2024-10-18 09:57:02)
license: NOASSERTION
Language: JavaScript .
Easy to use, Element Printing Plugin for jQuery
最后发布版本: 1.6.2 ( 2021-06-12 09:03:41)
jQuery Print Plugin
jQuery.print is a plugin for printing specific parts of a page
Usage
Include it in your HTML after importing jQuery, like:
<script type="text/JavaScript" src="path/to/jquery.print.js"></script>
Use it like:
$("#myElementId").print(/*options*/);
or
$.print("#myElementId" /*, options*/);
You can submit the options object like:
$("#myElementId").print({
globalStyles: true,
mediaPrint: false,
stylesheet: null,
noPrintSelector: ".no-print",
iframe: true,
append: null,
prepend: null,
manuallyCopyFormValues: true,
deferred: $.Deferred(),
timeout: 750,
title: null,
doctype: '<!doctype html>'
});
Currently this plugin supports the following options:
globalStyles
- Default:
true
- Acceptable-Values: Boolean
- Function: Whether or not the styles from the parent document should be included
mediaPrint
- Default:
false
- Acceptable-Values: Boolean
- Function: Whether or not link tags with media='print' should be included; Over-riden by the
globalStyles
option
stylesheet
- Default:
null
- Acceptable-Values: URL-string or Array of URL-strings
- Function: URL of an external stylesheet to be included
noPrintSelector
- Default:
".no-print"
- Acceptable-Values: Any valid
jQuery-selector
- Function: A selector for the items that are to be excluded from printing
iframe
- Default:
true
, creates a hidden iframe if no-vaild iframe selector is passed - Acceptable-Values: Any valid
jQuery-selector
or Boolean - Function: Whether to print from an iframe instead of a pop-up window; can take the
jQuery-selector
of an existing iframe as value
append/prepend
- Default:
null
- Acceptable-Values: Any valid
jQuery-selector
or HTML-text - Function: Adds custom HTML before (prepend) or after (append) the selected content
manuallyCopyFormValues
- Default:
true
- Acceptable-Values: Boolean
- Function: Should it copy user-updated form input values onto the printed markup (this is done by manually iterating over each form element)
deferred
- Default:
$.Deferred()
- Acceptable-Values: Any valid
jQuery.Deferred
object - Function: A jQuery.Deferred object that is resolved once the print function is called. Can be used to setup callbacks - see wiki
timeout
- Default:
750
- Acceptable-Values: Time in Milliseconds for
setTimeout
- Function: To change the amount of max time to wait for the content, etc to load before printing the element from the new window/iframe created, as a fallback if the
load
event for the new window/iframe has not fired yet
title
- Default:
null
, uses the host page title - Acceptable-Values: Any single-line string
- Function: To change the printed title
doctype
- Default:
'<!doctype html>'
- Acceptable-Values: Any valid doctype string
- Function: To prepend a doctype to the printed document frame
Tested with
jQuery
Browsers
- Google Chrome - v 20, 26, 48, 55
- Internet Explorer - v 10, 11
- Firefox - v 35
License
Demo
最近版本更新:(数据更新于 2024-09-27 15:21:37)
2021-06-12 09:03:41 1.6.2
2021-06-08 20:05:40 1.6.1
2018-08-21 12:13:35 1.6.0
2017-01-04 16:28:32 1.5.1
2016-09-15 21:47:15 1.5.0
2016-06-14 22:11:59 1.4.1
2016-02-10 15:36:05 1.4.0
2015-08-01 22:36:01 1.3.3
2015-04-27 19:54:25 1.3.2
2015-01-20 15:21:04 1.3.1
主题(topics):
element, jquery, plugin, print
DoersGuild/jQuery.print同语言 JavaScript最近更新仓库
2024-11-05 19:13:47 jerryc127/hexo-theme-butterfly
2024-11-05 13:53:42 LiteLoaderQQNT/LiteLoaderQQNT
2024-11-03 02:40:36 chris81605/Degrees-of-Lewdity_Cheat_Extended
2024-11-01 21:55:46 projectdiscovery/nuclei-templates
2024-11-01 19:24:44 NumberSir/DoL-I18n-Build
2024-11-01 12:25:14 midoks/mdserver-web