【发布时间】:2011-06-23 09:05:08
【问题描述】:
我正在尝试使用printElement 插件打印我的 div 内容。 div 有很多文本,所以有一个滚动条。问题是插件只打印实际在屏幕上的部分文本。如何打印所有文本?
编辑:
我需要一个解决方案,该解决方案将使用外部 css 中的样式打印此 div。
【问题讨论】:
我正在尝试使用printElement 插件打印我的 div 内容。 div 有很多文本,所以有一个滚动条。问题是插件只打印实际在屏幕上的部分文本。如何打印所有文本?
编辑:
我需要一个解决方案,该解决方案将使用外部 css 中的样式打印此 div。
【问题讨论】:
https://github.com/jasonday/printThis
可使用其他 css 文件和其他选项进行配置。
【讨论】:
<div class="printclass">Print</div>
<div id="mydivid">
Your content goes here
</div>
</div>
<script type="text/javascript">
$(function(){
$( ".printclass" )
.attr( "href", "javascript:void(0)")
.click(function(){
// Print the DIV.
$( "#mydivid" ).print();
// Cancel click event.
return( false );
});
});
</script>
【讨论】:
Uncaught TypeError: $(...).print is not a function.
【讨论】: