jQuery Effects

hide, show, toggle, fade, slide and animate.

✍️ 3 exercises + code challenge in this lesson
  • .hide(), .show(), .toggle()
  • .fadeIn(), .fadeOut(), .fadeToggle()
  • .slideDown(), .slideUp(), .slideToggle()
  • .animate({ properties }, duration): custom animations

Durations can be "slow", "fast" or milliseconds. A callback runs when the effect finishes.

Key Takeaways: jQuery Effects

Mastering jQuery Effects helps you write clean and reliable jQuery code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

jQuery Effects Code Example

jQuery
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>

<button id="toggle">Slide toggle</button>
<button id="fade">Fade toggle</button>
<button id="move">Animate</button>

<div id="panel" style="background:#E0F2FE;padding:14px;margin:8px 0">Sliding panel content</div>
<div id="ball" style="width:40px;height:40px;border-radius:50%;background:#0769AD;position:relative"></div>

<script>
  $("#toggle").click(() => $("#panel").slideToggle("slow"));
  $("#fade").click(() => $("#ball").fadeToggle());
  $("#move").click(() => {
    $("#ball").animate({ left: "250px" }, 800).animate({ left: "0px" }, 800);
  });
</script>
Free sign-in required · Google login available

jQuery Effects Practice Exercises

Check what you learned in “jQuery Effects”.

/ 3 solved
Fill in the blank

Toggle sliding the panel up and down.

$("#panel").();
✓ Correct! Not quite. Try again.
Multiple choice

Which method creates custom animations?

✓ Correct! Not quite. Try again.
Code challenge

Hide the #box element with jQuery's hide() method.

Write the code in the live editor. Your answer is checked automatically.

Free sign-in required · Google login available

to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services