Key Concepts

Review core concepts you need to learn to master this subject

jquery effects

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

jQuery Effects are jQuery object methods used to add animation and dynamic behavior to page elements. Effects can be used to show or hide elements, fade elements in and out, and more.

jquery hide effect

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

The jQuery .hide() effect method causes an element and the space it was occupying to disappear instantly from the page. When executed, the browser will render the HTML as if the hidden element does not exist.

jquery show effect

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

The jQuery .show() effect method causes an element, assuming it is hidden, to instantly appear on the page.

jquery toggle effect

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

The jQuery .toggle() effect method combines the effects of the .hide() and .show() methods. Every time the event listener is triggered, the element will alternate between displayed on the page and hidden from the page.

jquery fadeIn effect method

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

The jQuery .fadeIn() effect method causes a hidden element to gradually appear on the page. The method takes optional parameters.

The first optional parameter specifies the duration of the fading effect. The default value is 400 milliseconds.

The second parameter specifies the name of an “easing” function that determines the speed of the fading effect at different points in the animation. The default value is ‘swing’, where the fade-in effect is slower at the beginning/end and faster in the middle.

jquery fadeToggle method

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

The jQuery .fadeToggle() effect method combines the effects of the .fadeIn() and .fadeOut() methods. The element will alternate between gradually disappearing and appearing every time the event listener is triggered. This method takes optional parameters.

The first optional parameter specifies the duration of the fading effect. The default value is 400 milliseconds.

The second parameter specifies the name of an “easing” function that determines the speed of the fading effect at different points in the animation. The default value is ‘swing’, where the fading effect is slower at the beginning/end and faster in the middle.

jquery slideDown method

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

The jQuery .slideDown() effect method causes a hidden element to gradually appear on the page by sliding down its content.

This method takes an optional parameter that specifies the duration of the effect in milliseconds. If not specified, the default value of 400 milliseconds is used.

jquery slideUp method

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

The jQuery .slideUp() effect method causes an element and the space it was occupying to gradually disappear from the page by sliding up its content.

This method takes an optional parameter that specifies the duration of the effect in milliseconds. If not specified, the default duration is 400 milliseconds.

jquery slideToggle method

// The .show() effect causes the #menu element to // appear once the #menu-button element is clicked. $('#menu-button').on('click', event => { $('#menu').show(); });

The jQuery .slideToggle() effect method combines the effects of the .slideDown() and .slideUp() methods. This causes the element to alternate between gradually appearing by sliding down and gradually disappearing by sliding up every time the event listener is triggered.

The .slideToggle() method takes an optional parameter that specifies the duration of the effect. If not specified, the default value is 400 milliseconds.

Learn jQuery: Effects
Lesson 1 of 1
  1. 1

    jQuery Effects are a group of methods in the jQuery library that are responsible for adding dynamic behavior to websites. You may have seen many of these effects on modern websites without even rea…

  2. 2

    The first tool you will add to your jQuery effects tool belt is the […] method. When you hide an element, your browser will render the HTML as if the hidden element does not exist. It will disa…

  3. 3

    Now that we’ve learned how to hide elements on our page, we want to know how to make them reappear. Luckily, the […] method does the opposite of […] . If an element on your page is hidden, …

  4. 4

    Great work! Our table now has two buttons that hide and show our image. But wouldn’t it be nice to have one button do both? It is common for web pages to have one button that will either hide or sh…

  5. 5

    Great work! In this exercise, you will learn about two new methods that are similar to […] and […] . Take a look at the gif below: In this gif, the […] method is called on an HTML …

  6. 6

    Great work! With fade, our website is starting to look dynamic. […] is the third and final method in this trio of fade methods. This method is similar to […] . If you call […] on an elem…

  7. 7

    Have you ever been to a website and seen HTML elements slide into place? Many websites use this effect to show menus; you click on your profile image and a menu slides down revealing different sett…

  8. 8

    Wow! You’ve completed this table of 9 different jQuery effects. Great job! To review, the methods that we learned were: […] […] * […] These methods instantly hide or show element…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo