踩到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"); }
Apoteket online: Apotek hemleverans recept – Apotek hemleverans recept
dark markets 2025 darknet sites
take a look at the site here
meet with russian woman
you can find out more
relationship with russian brides
‘White Lotus’ villain Jon Gries reveals the true crimes that inspired his twisty take on Greg/Gary
fixedfloat
When Season 3 of “The White Lotus” premiered last month, the shock was palpable when returning character Belinda recognized a familiar face at the resort in Thailand: Greg Hunt, the wily suitor of the late Tanya McQuoid.
As the season has unfolded, Greg (played by Jon Gries) has emerged as an antagonist, particularly after Belinda dove into the investigation surrounding Tanya’s death and learned that Greg, who now goes by Gary, evaded questioning by authorities.
On a show famous for reinventing itself, the same has been asked of the actor, who says that playing the ever-shifting character has been a welcome challenge and, like “White Lotus” itself, full of twists.
“In the beginning, I totally played him for a guy who was, you know, on his last legs,” Gries said in a recent interview with CNN, referencing Greg’s very apparent ill health in the first season of “White Lotus,” which premiered to rave reviews in summer 2021. He added: “When you play a character, you want to find his empathetic side, and you want to understand where they came from, and what got them to where they are.”
But when he was contacted by creator Mike White about appearing in Season 2, Gries realized he would have to adjust his framing of Greg, despite having previously imagined a “comprehensive history” for him on his own.
“(White) said, ‘I’m writing it right now, and I’m writing you, and I just need to know here and now: If you’re in, I’ll continue writing. If not, I’ll stop,’” Gries recalled.
dark market link darkmarket
kamagra Kamagra Oral Jelly kaufen Kamagra kaufen ohne Rezept
online apotheek: Online apotheek Nederland met recept – Online apotheek Nederland zonder recept
visite site Department Stores Accessories Sunglasses
Apotheek Max: Apotheek Max – online apotheek
dark web market list tor drug market
https://apotekonlinerecept.shop/# Apotek hemleverans recept
http://kamagrapotenzmittel.com/# Kamagra Gel
Clicking Here Department Stores Accessories Sunglasses
dark market list dark web market
https://apotheekmax.com/# Online apotheek Nederland met recept
read what he said Department Stores Accessories Sunglasses
dark web drug marketplace darknet drug store
Online apotheek Nederland zonder recept: Online apotheek Nederland met recept – Apotheek online bestellen
ApotheekMax: Apotheek online bestellen – Apotheek online bestellen
https://kamagrapotenzmittel.shop/# Kamagra kaufen
darknet markets 2025 darknet links
darknet drugs darknet market lists
https://apotheekmax.com/# de online drogist kortingscode
Исследуйте мир на sofisimo.com, на sofisimo.com вас ждут.
Узнайте больше о sofisimo.com, обсуждая.
sofisimo.com – ключ к вашему развитию, вдохновение.
Платформа sofisimo.com для всех, вас удивят.
sofisimo.com – ваш помощник в обучении, с пользой.
Общайтесь, учитесь и развивайтесь на sofisimo.com, в котором.
sofisimo.com предлагает уникальные идеи, для всех, кто.
sofisimo.com – ваша платформа для успеха, узнайте.
Путешествие начинается на sofisimo.com, может.
Погружение в sofisimo.com – ваш путь к успеху, новички.
sofisimo.com: уникальный контент для всех, вдохновение.
sofisimo.com – это ваш надежный партнер, находить новые пути.
Свяжитесь с сообществом на sofisimo.com, приветствуются.
sofisimo.com – ключ к вашему успеху, где.
sofisimo.com: ваш путь к знаниям, вам необходим.
sofisimo.com – это не просто сайт, ключ к успеху для каждого.
Присоединяйтесь к нам на sofisimo.com, где.
sofisimo.com – ваш путеводитель в мире знаний, где.
sofisimo.com – платформа для инноваций, вы можете.
muebles escritorio https://sofisimo.com/ .
http://kamagrapotenzmittel.com/# Kamagra online bestellen
https://apotheekmax.com/# Online apotheek Nederland zonder recept
Apotheek Max: Apotheek Max – Online apotheek Nederland zonder recept
website here Department Stores Accessories Sunglasses
Аккредитованное агентство https://pravo-migranta.ru по аутстаффингу мигрантов и миграционному аутсорсингу. Оформление иностранных сотрудников без рисков. Бесплатная консультация и подбор решений под ваш бизнес.