Creating a dynamic webpage, I have incorporated four buttons that toggle the visibility of specific div elements. As part of my design, I want to invoke a custom function before initiating an AJAX request. This function will smoothly animate the current visible div by reducing its opacity to zero, then display a loading image. Once the AJAX request is completed, another custom function will animate the next div to be shown from zero opacity to 1, moving it from left to right. The goal is to achieve a visually pleasing transition similar to the interface on Windows Phone 7. Any suggestions on how to implement this effect?