tailieunhanh - Manning ASP.NET AJAX in Action PHẦN 8

Nếu bạn quyết định rằng cả hai máy chủ và khả năng khách hàng cần được quy định tại cùng một vị trí, bạn cần một điều khiển kịch bản. Đó là một máy chủHình 9,6 Trong mô hình mở rộng, một kiểm soát máy chủ nhận được các chức năng khách hàng khỏi sự kiểm soát Extender, | 366 CHAPTER 10 Developing with the Ajax Control Toolkit the animation classes. The following example will give you the opportunity to experiment directly with the JSON syntax for creating animations. In this section we ll return on the PhotoGallery control built in section . So far you ve created a client control to browse a set of images stored in the website. Your next goal is to enhance the control by adding an animated transition between the images. The transition you ll build isn t complex but it s effective as shown in figure . While the next image is being loaded you partially fade-out the current image then you resize it until it reaches the width and height of the next image to display. Finally the new image fades in and replaces the old image. Let s start by opening the file that contains the code for the PhotoGallery control. You have to modify the code so that when the next image is loaded a new method named _playTransition is called. This method is responsible for playing the animated transition and then calling the _displayImage method as soon as the transition is completed. First you must rewrite the _onImage-ElementLoaded method declared in the PhotoGallery s prototype as follows _onImageElementLoaded function Figure Example of an animated transition applied to the PhotoGallery control. The animations that make up the transition are defined through JSON objects. Animations 367 Then you must add a method called _playTransition to the constructor s prototype. The code for the _playTransition method is shown in listing . Listing Code for the _playTransition method Fade-in animation _playTransition function var currentimagesize height width var nextimageSize height width var fadein AnimationName Fadein AnimationTarget Duration .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.