JQuery Effects Flashcards

1
Q

The hide and show methods are great, but is one method that has the ability to do both? Write out an example using it.

A

$(‘.toggle-button’).on(‘click’, () => {
$(‘.first-image’).toggle();
})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How could you make the a button with a an class of ‘fade-out-button’ fade out when clicked on, and have it fade out with a duration of 4000 miliseconds?

A

$(‘.fade-out-button’).on(‘click’, () => {
$(‘.fade-image’).fadeOut(4000);
})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Say you want to have the duration of a fade out effect on an element to be the same as the duration for the fade in element. How could you do this?

A

$(‘.fade-toggle-button’).on(‘click’, () => {
$(‘.fade-image’).fadeToggle(“fast”);
})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

You have an element of the ‘menu-button’ class, how can you reveal it’s content, with a sliding down effect when clicked? Now what method can you use that will make it slide up and down?

A

$(‘.menu-button’).on(‘click’m () => {
$(.’menu-content’).slideDown(1000);
})

$(‘.menu-button’).on(‘click’, () => {
$(‘.menu-content’).slideToggle(‘slow’);
})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

If you wanted to lets say show all three buttons when one button is clicked, how could you do this?

A

$(.’smiley’).on(‘click’, () => {
$(.wrong-text-one, .wrong-text-two, .wrong-text-three).show();
})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Show a class of ‘error’ only if the page has certain content/text showing.

A

if ($(“div:contains”(‘Invalid Email or password.’)”).length) {
$(‘.error’).show();
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly