tailieunhanh - PHP jQuery Cookbook phần 6

Tạo ra một trò chơi Tic-Tac-Toe với các hiệu ứng thông báo một người dùng trong khi một yêu cầu AJAX là trong tiến trình Tạo các hộp mở rộng và đóng mở (accordion) Fading một phần tử sau khi cập nhật nó nổi một hộp vào các mặt hàng nhu cầu cập nhật trong một giỏ mua hàng | Simpo PDF Merge and Split Unregistered Version - http Simpo PDF Merge and Split Unregistered Version - http 6 Adding Visual Effects to Forms In this chapter we will cover Creating a Tic-Tac-Toe game with effects Informing a user while an AJAX request is in progress Creating expandable and collapsible boxes accordion Fading an element after updating it Floating a box on demand Updating items in a shopping cart Introduction Adding jQuery to web pages can result in amazing effects and user interaction if used wisely. There are many plugins in jQuery that already provide most of the utilities and widgets presented in this chapter. But most of the time these plugins try to be so complete that unnecessary features creep in. In this chapter we will be creating widgets such as accordion floating DIVs and yellow fade techniques that are common in modern AJAX applications. We will create these in the simplest manner with minimum code. Simpo PDF Merge and Split Unregistered Version - http Adding Visual Effects to Forms------------------------------------------------------------------- Creating a Tic-Tac-Toe game with effects Web forms should be as user-friendly as possible to ease the life of users. Users should be clear as to which part they are interacting with. In this recipe we will create a game of Tic-Tac-Toe. You may have already played this game as a kid. This will present a good example of how different sections of a page can be highlighted for a user to let him or her know where he or she is interacting on the page. Ours will be a two-player game where we will present the user with a grid of 3 3 or 5 5 depending on his selection. Hovering over a box in the grid will highlight that box and clicking on a box will put either a cross or a circle depending on the player s turn. With every mark made on the grid we will switch user turns and check if a user has won or not. Getting ready Create a folder named Recipei inside