更新:下面的CSS解決方案。打印時不要使用jQuery DOM更改
我使用的是fullpage.js jQuery插件,它不幸也會影響網頁的打印,只顯示當前的視口顯示及其兄弟。
我遇到的問題是打印命令使用DOM(顯然),但插件已經在DOM中內聯CSS更改。有沒有辦法可以禁用print
的DOM更改?
這並不工作,但這裏是我的想法:
$(document).ready(function() {
if(@media !print) { // PS: Not real code!
$('#fullpage').fullpage();
}
});
------ CSS解決方案-------
Praveen's reply引導我正確的軌道上。覆蓋fullpage.js所需的CSS內嵌樣式是:
/* Override javascript inline styles */
html,
body {
overflow: visible !important;
height: auto !important;
}
.fullpage-wrapper {
height: auto !important;
transform: none !important;
transition: none !important;
}
.fp-section {
height: auto !important;
}
.fp-slidesContainer {
width: auto !important;
transition: none !important;
transform: none !important;
}
.fp-slides,
.fp-slides * {
position: static !important;
}
.fp-slide {
width: auto !important;
}
爲什麼會一個關心現在的印刷? – OddDev
@OddDev由於可用性。即使你或我從不打印,也不代表別人不打印。 – Eystein
即使你或我從不使用IE6,也不意味着其他人不會。將無限項目添加到此列表中;) – OddDev