<style>
@media print {
#header, #footer, .no_print { display: none; }
}
</style>
// 프린트하지 않을 영역에 classname no_print 지정
function print() { //새창에서 프린트
var p = window.open(window.location.href, "_blank", "left=0, top=0, width=0, height=0");
var style = "<link rel='stylesheet' href='http://localhost:9000/space/css/room.css'>"
+ "<style> ul{list-style-type: none; padding: 0; display: inline-block;} ul span{box-sizing: border-box;}</style>";
p.document.write(style);
p.document.write($(".payment_wrap").html());
p.document.close();
p.focus();
p.print();
p.close();
}
function print() { //프린트 후 페이지 새로고침
var init = $("body").html();
window.onbeforeprint = function() {
var print_area = $("#print_area").html();
$("body").html(print_area);
$("body").css({"max-width":"800px", "min-width":"800px"});
};
window.onafterprint = function() {
location.reload();
};
window.print();
}
'프론트엔드 > JQuery' 카테고리의 다른 글
[JQuery] Ajax 답변삭제 팝업 (0) | 2021.06.16 |
---|---|
[JQuery] on 함수 (0) | 2021.06.15 |
[JQuery] Ajax (0) | 2021.06.11 |
[JQuery] 부트스트랩 - Carousel(캐러셀) 만들기 (0) | 2021.06.05 |
[JQuery] 클릭 이벤트 (0) | 2021.05.25 |