簡單易用的JQuery網頁內容打印插件——jQuery.print.js

原文鏈接:https://blog.csdn.net/fukaiit/article/details/79406114

1. 官方網址

下載jQuery.print.js、配置參數介紹、官方Demo

2. 簡介:

jQuery.print是一款簡單易容且功能強大的網頁內容打印jQuery插件。該網頁打印插件可以打印指定區域的網頁元素,可以指定跳過不打印某些元素,還可以打印整個頁面內容。並且提供了豐富的打印參數設置。

3. 瀏覽器兼容性:

Google Chrome - v 20, 26, 48, 55
Internet Explorer - v 10, 11
Firefox - v 35

4. 使用方法:

1)引入jQuery和jquery.print.js文件

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.print.js"></script> 

(2)打印

$("#myElementId").print(/*options*/);

或者

$.print("#myElementId" /*, options*/);

參數配置:

$("#myElementId").print({
    globalStyles: true,//是否包含父文檔的樣式,默認爲true
    mediaPrint: false,//是否包含media='print'的鏈接標籤。會被globalStyles選項覆蓋,默認爲false
    stylesheet: null,//外部樣式表的URL地址,默認爲null
    noPrintSelector: ".no-print",//不想打印的元素的jQuery選擇器,默認爲".no-print"
    iframe: true,//是否使用一個iframe來替代打印表單的彈出窗口,true爲在本頁面進行打印,false就是說新開一個頁面打印,默認爲true
    append: null,//將內容添加到打印內容的後面
    prepend: null,//將內容添加到打印內容的前面,可以用來作爲要打印內容
    deferred: $.Deferred()//回調函數
}); 



原文鏈接:https://blog.csdn.net/fukaiit/article/details/79406114

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章