踩到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"); }
Combination therapy is suggested for the treatment of moderate to severe infections, even if a single agent demonstrates activity. doxycycline for mrsa
doxycycline genital infection DOX did not exert any significant change in liver except dilatations of sinusoid capillaries.
cheap fexofenadine 120mg allegra 180mg price generic panadol
can you take doxycycline while pregnant and Tournier, H.
This was later to change. doxycycline for std
2008 Mar 25; 70 13 986- 7. doxycycline killed my dog
adult singles
free and best
online-dating-ukraine
buy clomiphene online buy clomiphene
https://24hr-pharmacy.top/# canadian drugs online pharmacy
https://24hr-pharmacy.top/# buying from canadian online pharmacies
online dating match
new dating
online dating women
buy clomid for men buy clomid for men
order acyclovir 400mg generic zovirax online perindopril 8mg pills
https://doxycycline.pro/# how to get doxycycline without prescription
ivermectin 500ml ivermectin mange treatment dosage
does tamoxifen make you tired Never having done this before but consulted and almost started the process with another clinic she made us feel safe and explained every step and process and was candid.
ivermectin for dogs dosage oral ivermectin for guinea pigs
nolvadex reddit
We also measure estradiol levels on a regular basis during gonadotropin stimulation in order to optimize gonadotropin dosing. tamoxifen and weight gain
stromectol lice what is stromectol
All rights reserved. tamoxifen metabolism Usually take between cycle therapy to produce more time frame.
5 months CI 95 3. nolvadex online
nolvadex testosterone
Intention to treat analysis or loss to follow up was not mentioned. is a half dose of tamoxifen better than none
where to buy pct nolvadex
https://stromectol1st.com/# ivermectin egg withdrawal
stromectol ingredient what does ivermectin treat in dogs
stromectol where to buy ivermectin dose for head lice
nolvadex while on cycle
fesqvb