踩到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"); }
buy atorvastatin 40mg generic generic tenormin 100mg buy lyrica 75mg online
help with scholarship essays
what is the best essay writing service
who can i pay to write my essay
natural ed medications erection pills online
buy tizanidine 2mg generic cialis 5mg cheap cialis overnight shipping usa
what are the best essay writing services
medical school essay service
what is the best custom essay site
best canadian pharmacy to buy from cheap viagra canadian pharmacy
easy essay writer
top 10 essay writing services
essay writing services singapore
dating apps free
dating web site
local free chatline
purchase zetia generic buy motilium 10mg online cheap baclofen 10mg canada
What should I do if I have trichomoniasis. doxycycline dog How allergies impact your dog s quality of life.
buying doxycycline online in usa can you buy doxycycline over the counter australia
https://ed-pills.xyz/# cheapest ed pills online
dating site for free
free online dating site
dating sims free online japanese adult
https://24hr-pharmacy.top/# canadian prescription drugs
doxycycline for cellulitis dose Balducci C, Santamaria G, La Vitola P, Brandi E, Grandi F, Viscomi AR, Beeg M, Gobbi M, Salmona M, Ottonello S, Forloni G.
buy clomiphene clomid
Monitor Closely 21. headaches from doxycycline
doxycycline warnings For many years the only option for patients with visually significant Fuchs dystrophy was a full thickness corneal transplant or penetrating keratoplasty PKP.
https://24hr-pharmacy.top/# how to order prescription drugs from canada
Shah BK, Sharma S, Shakya G, Upadhyay BP. how long do doxycycline side effects last What is Doxycycline HYC 100mg used for.
buy oxcarbazepine 300mg pill order crestor 20mg without prescription rosuvastatin 10mg for sale
Also, 40 mL of 2 lidocaine is given to effect anesthesia from the initial excitation. doxycycline hyclate 100mg
i want to buy doxycycline 100mg P P P a; d, inset; f; i are 10 Ојm.
doxycycline and pregnancy How Does Doxycycline Work.
local women dates
ourtime logga in
freetalk45
cost of doxycycline in india 631311 doxycycline
what does doxycycline look like The type 2 diabetes statistics by state tiger was also very responsive, and suddenly avoided the python is first attack with a jump, but the python would naturally not give up when it suffered, and then frantically bit the other side again.
doxycycline 100mg acne I get the SPF 15, but they have a lot of options.
doxycycline cost canada buy doxycycline over the counter uk
Similarly, when the dose is lowered to a maintenance level or to be discontinued, the amount should be reduced gradually over four or five days. what is doxycycline 18, 376 379 2012.