Question
What would be the advantage of using a string argument over a number one on .fadeToggle()
?
Answer
Even though methods like .fadeToggle()
have a small number of string arguments it responds to, there are times when we do not have a specific need nor requirement for a speed on the effect, that is when the string arguments come in handy, since we do not want an effect that will go unnoticed but we do not care much on how long it should take.
According to the JQuery documentation on .fadeToggle()
it has two possible string arguments:
'fast' and 'slow'
fast is 200 milliseconds and slow is 600 which is not very slow but it is (based on attention span) a good amount of time to appreciate the fade in or out transition.
Now if we do have time to experiment or we have a visual in mind of what we want, it is recommendable to use numbers, otherwise remembering that the default value is 400, ‘fast’ and ‘slow’ can provide a quick and professional fix to how the effect should transition.