Module 6 - Lesson 6

Hiding & Showing with jQuery

In this lesson, we’ll look into various code jQuery methods for hiding and showing website elements. I’ll show you examples of using hide(), show(), fadeIn(), slideUp(), slideDown(), and slideToggle().

Video Chapters

00:00 Introduction

01:00 Show and Hide

02:12 Fade in and out

04:54 Fade To

07:03 Slide Up and Down

09:02 Slide Toggle

Example:

$('h1').hide();

$('.hidden').show();

$('#box1').fadeOut();

$('.hidden').fadeIn(3000);

$('#box1').click(function(){
	$(this).fadeOut(4000);
});

$('#box1').click(function(){
	$(this).fadeTo(3000, 0.5, function(){
		// animation is complete
	});
});

$('h1').slideUp();

$('.hidden').slideDown();

$('button').click(function(){
	$('.box').slideToggle();
});

Join the discussion

Share your thoughts about this lesson with fellow students!

Login to your Account

If you're a DSA Student, please log in to your account to access the course content.

Sorry, you don't have access to this content.

It looks like you're not enrolled in Divi Stylist Academy.