(^228) ❘ CHAPTER 8 ANIMATION AND EASING EFFECTS
$('input#exampleAnimationToggle').click(
function(event)
{
event.preventDefault();
if (!animating)
{
animating = true;
var easing = $('select#exampleAnimationEasing').val();
var duration = parseInt($('input#exampleAnimationDuration').val());
$('div#exampleDialog').toggle(
duration,
easing,
function()
{
animating = false;
}
);
}
}
);
$('input#exampleAnimationDuration').change(
function()
{
$(this).attr('title', $(this).val());
}
);
}
);
The preceding example is Example 8-1 in the source code download materials. Figure 8-1 shows the
results of loading up Example 8-1.html in a browser.
In Example 8-1, you created an application that allows you to test the most-used aspects of the show(),
hide(), and toggle() methods. This includes testing every possible type of easing offered in both
default jQuery and the various easing extensions offered as part of jQuery UI. All the easings offered
by jQuery are specifi ed in the
elliott
(Elliott)
#1