Web Development with jQuery®

(Elliott) #1

(^204) ❘ CHAPTER 7 AJAX


{


$(this).animate({
'background-color' : 'rgb(255, 255, 255)'
},
1000
);
}
}
);
}
);
}
);

The JavaScript demonstrates how an external script is loaded via jQuery’s $.getScript() method.
The $.getScript() method takes two arguments: The path to the script that you want to load, and
like jQuery’s other AJAX request method, it also allows a callback function, which is executed when
the script has been loaded and successfully executed.

Figure 7-5 shows a snapshot after the animation that takes place when you click a day in the calen-
dar. The background-color animates from white to rgb(200, 200, 200) (a shade of gray) and when
clicked again it animates from rgb(200, 200, 200) back to white, or rgb(255, 255, 255). jQuery
animations are covered in more detail in Chapter 8, “Animation and Easing Effects.”

FIGURE 7-5


http://www.it-ebooks.info

Free download pdf