So, here it is at last: How to make your webpages interactive. How do I make an interactive story?
What we're headed to, by the end of the lesson, is learning how to write a few lines of code that you can reuse and adapt to do a huge range of interactions, from slideshows to timelapses to tabs to calculators to simple animation.
So keep that in mind. Three lines of code. It's going to be a bit of a walk, but we'll get there together.
To start us off, I thought it'd be helpful to show you how an interactive works.
It's the Times map of the oil spill of the Gulf. This was before I got there, but I think this is a great graphic: It's simple, tells a meaningful story, and is interactive in exactly the way you want for this.
Showing example form a smaller newsroom. If you have two photos, and some knowledge, you can do this. And it's powerful.
This is what Andrew was talking about, interaction.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
</head>
</html>
Basically, you find the URL of a jQuery file, and tell your Web page to load it. Google is willing to pay the costs of sending this file to millions of people, and lets you use the file on their computers for free.
So: Google jQuery. Go to page. Copy the URL.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<!-- Add the following line -->
<script src="js/script.js"> </script>
</head>
</html>
Basically, you find the URL of a jQuery file, and tell your Web page to load it. Google is willing to pay the costs of sending this file to millions of people, and lets you use the file on their computers for free.
So: Google jQuery. Go to page. Copy the URL.
jQuery("img").fadeOut();
Helpful reference for jQuery.
jQuery("img").fadeOut();
sisi("door").open();
sisi("door").close();
sisi(".main-door").open();
<img src="http://codewithme.us/images/owl.gif" />
<p>Click to shoo away the owl! </p>
jQuery("p").click(function() {
jQuery("img").fadeOut();
});
<img src="http://codewithme.us/images/owl.gif" />
<p>Click to shoo away the owl! </p>
jQuery("______").______(function() {
jQuery("______").______();
});
<img src="http://codewithmemiami.com/images/owl.gif" />
<p>Click to shoo away the owl! </p>
jQuery("paragraph").is clicked(function() {
jQuery("img").will fade out();
});
<img src="http://codewithme.us/images/owl.gif" />
<p>Click to shoo away the owl! </p>
jQuery("p").click(function() {
jQuery("img").fadeOut();
});
<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="js/script.js"></script>
</head>
<body>
<img src="http://codewithme.us/images/owl.gif" />
<p>Click to shoo away the owl!</p>
</body>
</html>
jQuery("p").click(function() {
jQuery("img").fadeOut();
});
<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="js/script.js"></script>
</head>
<body>
<img src="http://codewithme.us/images/owl.gif" />
<p>Click to shoo away the owl!</p>
</body>
</html>
jQuery(document).ready(function() {
jQuery("p").click(function() {
jQuery("img").fadeOut();
});
});