简体   繁体   English

jQuery PrintMe插件CSS样式不包括在内

[英]Jquery PrintMe Plugin Css Style not included

I'm trying to print my div with PrintMe plugin. 我正在尝试使用PrintMe插件打印div。 Everything works perfect except for including CSS.. 除了包括CSS之外,其他所有东西都可以完美运行。

Here's the link of the usage. 这是用法的链接。

PrintMe ReadMe page PrintMe自述页面

And below is what I have in my index.php code. 下面是我的index.php代码中的内容。

$("#print").click(function(){
  $("#articleonly").printMe({ "path": ["ArticleStyle.css"] });
});

ArticleStyle.css is located at the same directory as the index.php file. ArticleStyle.css与index.php文件位于同一目录。

Css File code is as below. CSS文件代码如下。

.print_en {
  font-family: 'EB Garamond', serif;
  font-size: 18px;
}
.print_ko {
  font-family: 'KoPub Batang', serif;
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: -1px;
  font-weight: 100;
}
#article_title {
  text-indent: 5px;
}

I thought maybe I have to import Web-font at CSS, but other properties don't seem to work anyway. 我以为也许我必须在CSS上导入Web字体,但是其他属性似乎仍然无法正常工作。

And below is the div I'm trying to print with CSS. 下面是我要使用CSS打印的div。

<div id="articleonly" class="print_<?php echo $lang; ?>">
  <?php
    //Title
    echo "<h1 id='article_title'>".htmlspecialchars($article["$title"])."</h1>";
    //Contents
    echo $article["$contents"]."</br>";
    //Author
    // echo "Author :".$article["name"];
  ?>
</div>

ps I tried putting ./ and / at the path and getting off [] from the path.. Even tried modifying the printme.js file to just load the css file directly. ps我尝试将./和/放在路径上,然后从路径下移[]。甚至尝试修改printme.js文件以直接加载css文件。

If anyone can help, I'd be forever in your debt! 如果有人可以提供帮助,我将永远背负着您的债!

You can try giving the absolute path of ArticleStyle.css instead of relative path. 您可以尝试提供ArticleStyle.css的绝对路径,而不是相对路径。

$("#print").click(function(){
  $("#articleonly").printMe({ "path": ["http://absolute-path/ArticleStyle.css"] });
});

Do replace absolute-path with the path to css. 不要将绝对路径替换为css的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM