1 回答

TA貢獻1818條經驗 獲得超3個贊
Wicket 不為此提供解決方案。大多數 Wicket 應用程序使用全頁重新提醒/重定向或 Ajax 來僅更新頁面的一部分,而不是整個頁面。
我建議您嘗試使用 CSS 關鍵幀。這個想法是在這兩個 JS 事件上將 CSS 類添加到頁面正文:beforeunload和DOMContentLoaded(又名domready)。當beforeunload被觸發時,您需要刪除fade-in并添加fade-outCSS 類。并對 執行相反的操作DOMContentLoaded。
CSS 將如下所示:
/* make keyframes that tell the start state and the end state of our object */
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.fade-in {
opacity:0; /* make things invisible upon start */
-webkit-animation:fadeIn ease-in 1; /* call our keyframe named fadeIn, use animattion ease-in and repeat it only 1 time */
-moz-animation:fadeIn ease-in 1;
animation:fadeIn ease-in 1;
-webkit-animation-fill-mode:forwards; /* this makes sure that after animation is done we remain at the last keyframe value (opacity: 1)*/
-moz-animation-fill-mode:forwards;
animation-fill-mode:forwards;
-webkit-animation-duration:1s;
-moz-animation-duration:1s;
animation-duration:1s;
}
我不太擅長 CSS,所以最好向 Google 詢問更多信息。
添加回答
舉報