Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

CHAPTER 10: Using jQuery Effects > Creating Custom Effects - Pg. 293

CHAPTER 10 USING JQUERY EFFECTS You don't have to fade elements to the extremes of the opacity range. You can specify intermediate values as well, as Listing 10-11 demonstrates. Listing 10-11. Fading to a Specific Opacity ... <script type="text/javascript"> $(document).ready(function() { $("<button>Fade</button>").insertAfter("#buttonDiv button") .click(function(e) { $('img').fadeTo("fast", 0.4); e.preventDefault(); }); }); </script> ... You can see the effect in Figure 10-11. Figure 10-11. Fading to a specific opacity Creating Custom Effects jQuery doesn't limit you to the basic slide and fade effects. You can create your own as well. Table 10-6 shows the methods that you use for this. 263