踩到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"); }
2020 Dec 22; 12 1201 1213 cialis from india
https://buytadalafil.icu/# tadalafil 22 mg
https://amoxil.best/# can you buy amoxicillin uk
https://amoxil.best/# amoxicillin 250 mg
cheap essay writing service
best online essay writers
cheapest custom essay writing
order valacyclovir generic buy finasteride 5mg sale cheap diflucan 200mg
amoxicillin buy no prescription zithromax online usa no prescription
purchase zofran generic simvastatin 20mg pills buy simvastatin 10mg generic
I am continuously invstigating online for ideas that can help me. Thx!
Aurelio, USA 2022 06 18 02 24 17 is it safe to take lasix while pregnant
PMID 16323194 Clinical Trial is lasix potassium sparing Isolation of primitive human hematopoietic progenitors on the basis of aldehyde dehydrogenase activity
https://buytadalafil.icu/# price comparison tadalafil
lasix fluid Prescribe KCl or K phosphate if hypophosphatemia present
lasix for pneumonia Cardiomyocyte fate mapping
What a poop sandwich that show was lasix and enalapril for dogs It undergoes rigorous internal medical review and is updated regularly to reflect new information
Neurobehavioral deficits were evaluated daily for 1 week or 2 weeks followed by infarct volumes measurements by hematoxylin eosin HE staining demadex vs lasix Lindau ST, Abramsohn EM, Matthews AC
Does anyone know how these natural estrogen blockers work and what side effects they might have lasix drug interactions
pamabrom vs lasix VTE is a common complication that is associated with significant morbidity and mortality in cancer patients
How Can One Tell If I Have Diabetes By Examining My Blood lasix overdose
essays to buy
essays about community service
custom essays for cheap
oral meloxicam tamsulosin 0.2mg canada buy generic flomax
Treating an underlying condition like malnutrition or hyperthyroidism can work as well dosage of lasix for congestive heart failure
lasix for chf The results of these studies illustrate that the MammaTyper assay is precise upon repetition over short or longer intervals of time
Samples were not diluted to carry out the measurements and assays were performed at 25 C lasix diuretic side effects
I get a scan every two read more does lasix lower potassium
custom essays essay help
essay help chat
professional essay editing service
lasix side effects in dogs It is a search engine which contains information on about 900 public and private assistance programs that help those with financial need
lasix drug interactions com 20 E2 AD 90 20Viagra 20Tablet 20Price 20In 20Tamilnadu 20 20Viagra 20Bij 20Apotheek 20Verkrijgbaar viagra bij apotheek verkrijgbaar However, during cross examination prosecutor John Guy brought out the mannequin as he attempted to demonstrate that Zimmerman s version of the fight may not be accurate
Tumor cells visible underneath the window were recorded at multiple positions using z stack timelapses lasix iv po conversion New Methods for Statistical Modeling of Neuroscience Data
buy levaquin avodart 0.5mg generic ranitidine 300mg ca