29.07.2016 Views

front-end-developer_1_

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Front-End-Developer - Level 1<br />

04.Simple Effects<br />

Embedded Video: https://www.youtube.com/watch?v=1O4VzVJc2Do?rel=0<br />

Popping up dialogue boxes isn't very interesting, so let's move on to actually manipulating<br />

our web page by showing and hiding elements. Here's the HTML for the page we'll work on:<br />

peek-a-boo.html<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Peek-a-boo<br />

<br />

<br />

<br />

Peek-a-boo<br />

Let's play peek-a-boo. Click here to see the surprise!<br />

<br />

<br />

<br />

<br />

Obviously, this doesn't work yet. The first thing we should do is to hide the walrus with a bit<br />

of CSS. As usual, we'll make a file called styles.css in our css folder. Then, we'll add a<br />

CSS rule to hide the image:<br />

styles.css<br />

img {<br />

}<br />

display: none;<br />

Now, we can use jQuery to show the walrus when you click the paragraph above it:<br />

scripts.js<br />

Simple Effects<br />

162

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!