More Javascript and Custom Fonts
Agenda
- Weekly discussions.
- Building blocks of Javascript.
- Work session on Javascript.
- Custom fonts.
Assignments Due before class Tuesday, April 1
- Contact your news nerd profile subject
- Start a new page, and make three colored rectangles. Use jQuery to change the class names of the rectangles when a user clicks on them. When clicked on, one rectangle should change colors, one rectangle should get wider, and one rectangle should get rounded corners.
- Start a second new page, and include a fake headline and a paragraph of lorem ipsum text. Style the text on the page using one custom font from Google Fonts.
Common Questions
How do I include jQuery on my page?
Paste the following code into your HTML file immediately before the </body>
tag on your page:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
How do I include my own Javascript on my page?
Put it inline in your HTML file by including an opening and closing script tag. Your Javascript goes between the <script>
and </script>
tags. Like with the jQuery link, your Javascript should go directly before the </body>
tag in your HTML document. It should go after the jQuery code.
Here is what that looks like:
<html>
<body>
Here is some HTML
<script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
// Here is some Javascript
</script>
</body>
</html>
What is the difference between Javascript and jQuery?
Javascript is a computer programming language. It’s the scripting language that browsers use when rendering web pages, and it’s become the most popular proramming language in the world.
jQuery is a Javascript library that makes writing Javascript easier. A single line of code in jQuery might take many lines of code in Javascript. Beginners often start with jQuery, because it’s easier to understand than Javascript, but professionals use it too. More than half of the most visited one million websites use jQuery.
Why can’t I figure this out? Is this really hard?
Yes. Javascript is more complex than CSS. But you can learn it. We will spend a lot of time in class going over the basic ideas.
Where can I find an example of simple uses of jQuery?