踩到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"); }
Banyak pemain menikmati jackpot harian di slot: slot demo gratis – slot demo pg gratis
Kasino di Bali menarik banyak pengunjung http://preman69.tech/# Kasino sering mengadakan turnamen slot menarik
garuda888 garuda888 Banyak kasino memiliki promosi untuk slot
Slot dengan fitur interaktif semakin banyak tersedia: bonaslot – bonaslot.site
https://garuda888.top/# Slot dengan grafis 3D sangat mengesankan
В 2025 году ключ активации Windows 11 станет ключевым элементом для пользователей, стремящихся воспользоваться всеми преимуществами этой современной операционной системы. С учетом регулярных обновлений и нововведений, направленных на улучшение производительности и безопасности, активированный статус обеспечит доступ к последним функциям и патчам. ключ продукта виндовс 11
Slot memberikan kesempatan untuk menang besar https://bonaslot.site/# Mesin slot menawarkan pengalaman bermain yang cepat
bonaslot.site BonaSlot Slot menjadi daya tarik utama di kasino
Regards for helping out, superb info.
Kasino di Bali menarik banyak pengunjung https://slotdemo.auction/# Permainan slot bisa dimainkan dengan berbagai taruhan
Kasino menawarkan pengalaman bermain yang seru https://bonaslot.site/# Slot dengan grafis 3D sangat mengesankan
Jackpot progresif menarik banyak pemain: slot demo gratis – slot demo pg gratis
http://garuda888.top/# Mesin slot digital semakin banyak diminati
Kasino mendukung permainan bertanggung jawab https://garuda888.top/# Slot memberikan kesempatan untuk menang besar
http://bonaslot.site/# Slot menawarkan berbagai jenis permainan bonus
Slot dengan pembayaran tinggi selalu diminati: BonaSlot – bonaslot.site
подборки фильмов в хорошем качестве hd rezka сериалы мелодрамы на телевизоре
Slot menjadi bagian penting dari industri kasino http://garuda888.top/# Kasino menyediakan layanan pelanggan yang baik
http://preman69.tech/# Jackpot besar bisa mengubah hidup seseorang
http://bonaslot.site/# Mesin slot sering diperbarui dengan game baru
Slot dengan tema film terkenal menarik banyak perhatian: slot88.company – slot88.company
https://garuda888.top/# Slot menawarkan kesenangan yang mudah diakses
Kasino memiliki suasana yang energik dan menyenangkan: garuda888 – garuda888
лучшие аниме 2025 бесплатно hdrezka комедии
Slot memberikan kesempatan untuk menang besar https://preman69.tech/# Slot dengan pembayaran tinggi selalu diminati
Cute baby animals bring visitors to zoos and aquariums. What happens when they grow up?
арбитраж трафика тг
One of the best things that can happen to a zoo or aquarium is for one of their resident animals to go viral.
Just look at the multi-hour-long lines to see Moo Deng, a pygmy hippo in Thailand who has become an internet sensation following her July 2024 birth. The sassy animal is now a full-on brand, with Khao Kheow Open Zoo selling Moo Deng merchandise and even releasing a single “by” the hippo in multiple languages.
Meanwhile, Pesto — a baby king penguin who was eating more fish than his parents by the time he was a few weeks old — is also an online celebrity, with human stars like Olivia Rodrigo and Katy Perry stopping by to meet him.
But what happens when these cute animals become, well, less cute? The Sea Life Melbourne aquarium has already been planning for the next phase of Pesto’s life — and answering questions from the public about his changing appearance.
It’s normal for king penguins to lose their feathers by the time they’re about a year old and become confident swimmers. As a result, a spokesperson for the aquarium says, guests have started asking why Pesto looks different — or why they can’t find him at all.
“We are getting a few guests thinking we have moved him off display completely,” says the spokesperson. “Most of the team’s time is spent pointing him out to guests because he looks so different now.”
The bottom line is that cute baby animals make money.
Admission tickets are only the beginning. Many zoos and aquariums offer special “behind the scenes” or “zookeeper for a day” packages at much higher prices. At Sea Life Melbourne, standard entry tickets for adults start at $51, while the Penguin Passport — which include a 45-minute tour of the birds’ area and a look at how their food is prepared — is $199.
The real jackpot, though, is merchandise. Stuffed animals, T-shirts, fridge magnets, keychains, kids’ books and other branded products are a major way for zoos and aquariums to make money.
Scores of unexploded World War II bombs discovered under children’s playground
лаки джет официальный
Scores of unexploded bombs dating from World War II have been recovered from a children’s playground in northern England after a chance discovery.
Local officials in the town of Wooler, Northumberland called in bomb disposal experts after workers involved in a planned overhaul of Scotts Play Park found unexploded ordnance, the parish council said in a statement sent to CNN on Monday.
Two bombs were initially removed by the British Army, the UK Ministry of Defense said in a statement. The parish council was then advised that a full survey of the area was required, according to a council spokesperson.
Bomb disposal company Brimstone Site Investigation then uncovered 65 10-pound practice bombs and smoke cartridges on the first day of works, with a further 90 practice bombs recovered on the second day.
The company told CNN that the bombs date from World War II.
According to the parish council, all of the bombs need to be found and removed before the park can be reopened. It said 174 devices had been found so far.
Look of the Week: Kendrick Lamar’s Super Bowl pants signal the return of flares
кракен ссылка
This year’s Super Bowl halftime show was hardly a fashion extravaganza, with headliner Kendrick Lamar keeping things simple in a backwards cap and motorbike-style varsity jacket, which he kept on throughout.
And without the costume-change roulette we’ve come to expect of halftime shows, the internet fixated on one item in particular: his jeans.
While not quite the bell-bottoms of decades past (the 1970s and the 2000s, specifically), the Compton-born rapper’s washed denim pants flared out at the knee and dragged beneath his heels along the stage at Caesars Superdrome in New Orleans. His silhouette stood in stark contrast to that of record producer Mustard, who made a brief cameo in a pair of outsized jeans straight from the West Coast hip-hop playbook.
Opinions were, as ever, divided on social media. Some users described Lamar’s flares as “women’s jeans” and “Hannah Montana pants,” earning him comparisons to everyone from Jennifer Aniston to country singer Lainey Wilson. Others joked that their moms were looking for a similar pair or that they nodded to millennials, for whom flares were a teenage staple.
But those suggesting his style was outdated, or gender-inappropriate, may not have been paying attention to the recent resurgence of flares — in both womenswear and menswear. After all, Lamar’s jeans were designed by one of the most influential figures in modern fashion, Celine’s former creative director Hedi Slimane, before he departed the French label in October.
Kasino menyediakan layanan pelanggan yang baik http://slotdemo.auction/# Mesin slot digital semakin banyak diminati
Scores of unexploded World War II bombs discovered under children’s playground
лаки джет официальный сайт
Scores of unexploded bombs dating from World War II have been recovered from a children’s playground in northern England after a chance discovery.
Local officials in the town of Wooler, Northumberland called in bomb disposal experts after workers involved in a planned overhaul of Scotts Play Park found unexploded ordnance, the parish council said in a statement sent to CNN on Monday.
Two bombs were initially removed by the British Army, the UK Ministry of Defense said in a statement. The parish council was then advised that a full survey of the area was required, according to a council spokesperson.
Bomb disposal company Brimstone Site Investigation then uncovered 65 10-pound practice bombs and smoke cartridges on the first day of works, with a further 90 practice bombs recovered on the second day.
The company told CNN that the bombs date from World War II.
According to the parish council, all of the bombs need to be found and removed before the park can be reopened. It said 174 devices had been found so far.