May 2017
Intermediate to advanced
448 pages
10h 10m
English
With any jQuery effect, we can use one of the two preset speeds, 'slow' or 'fast'. Using .show('slow') makes the show effect complete in 600 milliseconds (0.6 seconds), .show('fast') in 200 milliseconds. If any other string is supplied, jQuery's default animation duration of 400 milliseconds will be used. For even greater precision, we can specify a number of milliseconds, for example, .show(850).
Let's include a speed in our example when showing the second paragraph of Abraham Lincoln's Gettysburg Address:
$(() => { $('p') .eq(1) .hide(); $('a.more') .click((e) => { e.preventDefault(); $('p') .eq(1) .show('slow'); $(e.target) .hide(); });});
When we capture the paragraph's appearance at roughly halfway through ...
Read now
Unlock full access