踩到Window resize在Preview print的雷
最近在作案的過程中遇到一個狀況,從Art design那邊拿到的頁面,會在Window resize的時候執行某個Function,本來一切都正常,但測試到Chrome和Firefox預覽列印時發現也會Trigger這個Event,會讓在預覽列印過後的頁面發生問題,所以必須要進行修正,以下是這個案例的說明:
先在測試頁加入以下的程式,發現在預覽列印的時候會Trigger window resize event:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Preview Print Test</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script> $(window).resize(function() { console.log("Window Resize"); }); </script> </head> <body> <h1>Window Resize Test</h1> </body> </html>
網路上搜尋了一下解決方案,將Script改寫如下,可以順利解決,但不知道是不是最好的方法,如果大家有更好的也別忘了告訴我唷~
openResizeFn(); // Chorme var print = false; var mediaQueryList = window.matchMedia('print'); mediaQueryList.addListener(function (mql) { if (mql.matches) { closeResizeFn(); } else { setTimeout(openResizeFn, 2000); } }); // Firefox window.onbeforeprint = function () { closeResizeFn(); }; window.onafterprint = function () { setTimeout(openResizeFn, 2000); }; // Common Function function openResizeFn() { $(window).on("resize", windowResize); } function closeResizeFn() { $(window).off("resize", windowResize); } function windowResize() { console.log("Window Resize"); }
https://farmabrufen.shop/# Farma Brufen
Farmacia online piГ№ conveniente
farmaci senza ricetta elenco: Cialis senza ricetta – farmaci senza ricetta elenco
Farmacia online miglior prezzo: Ibuprofene 600 prezzo senza ricetta – п»їFarmacia online migliore
A brief history of sunglasses, from Ancient Rome to Hollywood
kraken официальный сайт
Sunglasses, or dark glasses, have always guarded against strong sunlight, but is there more to “shades” than we think?
The pupils of our eyes are delicate and react immediately to strong lights. Protecting them against light — even the brilliance reflected off snow — is important for everyone. Himalayan mountaineers wear goggles for this exact purpose.
Protection is partly the function of sunglasses. But dark or colored lens glasses have become fashion accessories and personal signature items. Think of the vast and famous collector of sunglasses Elton John, with his pink lensed heart-shaped extravaganzas and many others.
When did this interest in protecting the eyes begin, and at what point did dark glasses become a social statement as well as physical protection?
The Roman Emperor Nero is reported as holding polished gemstones to his eyes for sun protection as he watched fighting gladiators.
We know Canadian far north Copper Inuit and Alaskan Yupik wore snow goggles of many kinds made of antlers or whalebone and with tiny horizontal slits. Wearers looked through these and they were protected against the snow’s brilliant light when hunting. At the same time the very narrow eye holes helped them to focus on their prey.
In 12th-century China, judges wore sunglasses with smoked quartz lenses to hide their facial expressions — perhaps to retain their dignity or not convey emotions.
It guides the company to build a balanced portfolio which will optimize their returns and also lessen the risk the companies have to take while taking the investment decisions.
viagra prezzo farmacia 2023 viagra farmacia viagra originale in 24 ore contrassegno
Предлагаем услуги профессиональных инженеров офицальной мастерской.
Еслли вы искали ремонт фотоаппаратов canon, можете посмотреть на сайте: ремонт фотоаппаратов canon
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
A brief history of sunglasses, from Ancient Rome to Hollywood
kraken официальный сайт
Sunglasses, or dark glasses, have always guarded against strong sunlight, but is there more to “shades” than we think?
The pupils of our eyes are delicate and react immediately to strong lights. Protecting them against light — even the brilliance reflected off snow — is important for everyone. Himalayan mountaineers wear goggles for this exact purpose.
Protection is partly the function of sunglasses. But dark or colored lens glasses have become fashion accessories and personal signature items. Think of the vast and famous collector of sunglasses Elton John, with his pink lensed heart-shaped extravaganzas and many others.
When did this interest in protecting the eyes begin, and at what point did dark glasses become a social statement as well as physical protection?
The Roman Emperor Nero is reported as holding polished gemstones to his eyes for sun protection as he watched fighting gladiators.
We know Canadian far north Copper Inuit and Alaskan Yupik wore snow goggles of many kinds made of antlers or whalebone and with tiny horizontal slits. Wearers looked through these and they were protected against the snow’s brilliant light when hunting. At the same time the very narrow eye holes helped them to focus on their prey.
In 12th-century China, judges wore sunglasses with smoked quartz lenses to hide their facial expressions — perhaps to retain their dignity or not convey emotions.
viagra online in 2 giorni: Farma Sild Italy – alternativa al viagra senza ricetta in farmacia
https://farmabrufen.shop/# BRUFEN prezzo
Farmacia online piГ№ conveniente
viagra online consegna rapida viagra senza ricetta viagra online spedizione gratuita
https://farmasilditaly.shop/# viagra online in 2 giorni
farmacia online
A brief history of sunglasses, from Ancient Rome to Hollywood
kraken тор
Sunglasses, or dark glasses, have always guarded against strong sunlight, but is there more to “shades” than we think?
The pupils of our eyes are delicate and react immediately to strong lights. Protecting them against light — even the brilliance reflected off snow — is important for everyone. Himalayan mountaineers wear goggles for this exact purpose.
Protection is partly the function of sunglasses. But dark or colored lens glasses have become fashion accessories and personal signature items. Think of the vast and famous collector of sunglasses Elton John, with his pink lensed heart-shaped extravaganzas and many others.
When did this interest in protecting the eyes begin, and at what point did dark glasses become a social statement as well as physical protection?
The Roman Emperor Nero is reported as holding polished gemstones to his eyes for sun protection as he watched fighting gladiators.
We know Canadian far north Copper Inuit and Alaskan Yupik wore snow goggles of many kinds made of antlers or whalebone and with tiny horizontal slits. Wearers looked through these and they were protected against the snow’s brilliant light when hunting. At the same time the very narrow eye holes helped them to focus on their prey.
In 12th-century China, judges wore sunglasses with smoked quartz lenses to hide their facial expressions — perhaps to retain their dignity or not convey emotions.
http://farmabrufen.com/# Farma Brufen
farmaci senza ricetta elenco
migliori farmacie online 2024: Farmacie online sicure – top farmacia online
farmacie online affidabili
Предлагаем услуги профессиональных инженеров офицальной мастерской.
Еслли вы искали срочный ремонт фотоаппаратов canon, можете посмотреть на сайте: ремонт фотоаппаратов canon в москве
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
farmacie online sicure: Brufen senza ricetta – comprare farmaci online all’estero
top farmacia online
prodamus промокод https://www.promokod-pro.ru .
migliori farmacie online 2024 BRUFEN prezzo migliori farmacie online 2024
https://farmatadalitaly.shop/# top farmacia online
comprare farmaci online con ricetta
A brief history of sunglasses, from Ancient Rome to Hollywood
kraken даркнет
Sunglasses, or dark glasses, have always guarded against strong sunlight, but is there more to “shades” than we think?
The pupils of our eyes are delicate and react immediately to strong lights. Protecting them against light — even the brilliance reflected off snow — is important for everyone. Himalayan mountaineers wear goggles for this exact purpose.
Protection is partly the function of sunglasses. But dark or colored lens glasses have become fashion accessories and personal signature items. Think of the vast and famous collector of sunglasses Elton John, with his pink lensed heart-shaped extravaganzas and many others.
When did this interest in protecting the eyes begin, and at what point did dark glasses become a social statement as well as physical protection?
The Roman Emperor Nero is reported as holding polished gemstones to his eyes for sun protection as he watched fighting gladiators.
We know Canadian far north Copper Inuit and Alaskan Yupik wore snow goggles of many kinds made of antlers or whalebone and with tiny horizontal slits. Wearers looked through these and they were protected against the snow’s brilliant light when hunting. At the same time the very narrow eye holes helped them to focus on their prey.
In 12th-century China, judges wore sunglasses with smoked quartz lenses to hide their facial expressions — perhaps to retain their dignity or not convey emotions.
https://farmaprodotti.shop/# top farmacia online
acquisto farmaci con ricetta
viagra acquisto in contrassegno in italia: viagra online consegna rapida – viagra online in 2 giorni
viagra 100 mg prezzo in farmacia: Viagra – viagra generico recensioni
https://farmaprodotti.com/# comprare farmaci online con ricetta
farmaci senza ricetta elenco
pillole per erezione in farmacia senza ricetta: Viagra – viagra originale recensioni
farmacie online affidabili
промокод продамус http://www.promokod-pro.ru .
Monday at St. Paul United Methodist Church with the Rev.
The precious metals contracts are some of the most noted contracts traded on the Commodity Exchange (COMEX) of New York.
https://farmasilditaly.com/# pillole per erezione immediata
comprare farmaci online con ricetta