navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

HTML5 Projects: Personalized Ads

HTML5 Projects: Personalized Ads

with Joseph Lowery

 


Imagine gathering some simple information about your site visitors (like gender, age, and location) and having that change the advertisements shown on the page. In this installment of HTM5 Projects, discover how to combine advanced HTML5 form elements to gather personal details from visitors and create a better user experience. Author Joseph Lowery shows how to leverage local storage to save and retrieve customization parameters, and work with the Canvas element to create a personalized ad on the fly. HTML5 technologies covered include HTML5 form elements, HTML5 local storage, HTML5 Canvas, and the HTML5 classList tag, which change classes on page elements without JavaScript.

show more

author
Joseph Lowery
subject
Business, Online Marketing, Web, User Experience, Web Design, Web Development
software
HTML 5, JavaScript , CSS 3
level
Intermediate
duration
1h 11m
released
Mar 01, 2013

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:03Hi, I'm Jo Lowery, and I'd like to welcome you to HTML5 Projects: Personalized Ads.
00:11Website visitors are often bombarded with a blizzard of product offerings,
00:15many of which don't fit their lifestyle or situation.
00:19If you could narrow the options so folks would be more likely to take advantage of an advertised
00:25special, wouldn't you think it would increase sales?
00:28In this course, we're going to bring some advanced HTML5 technologies to bear and create
00:34personalized advertisements based on user responses to basic questions.
00:39We'll save those preferences on their own system so anytime they visit the site, they'll
00:44see the offer created just for them.
00:48After you've had a chance to see what we're going to build, I'll explain the underlying
00:52technologies, including localStorage, the slider form element, canvas, and CSS3 transforms.
01:01Then we'll dig into the project itself.
01:04First, we'll set up the invitation which we'll make more tempting with a canvas-drawn text
01:10on one side and an easy to answer questionnaire complete with slider on the other.
01:16To keep people intrigued, we'll set up a card flipping transition between the two sides.
01:21Next, we'll create the offer page that will use HTML5 localStorage to handle the custom advertisement.
01:28Finally, we'll modify the initial page so that the users see a custom reminder of their
01:33special offer, all done with HTML5 canvas feature, and we don't ask them to fill out
01:39a form they've already completed.
01:42So let's get rolling on HTML5 Projects: Personalized Ads.
Collapse this transcript
About the exercise files
00:00I'm very happy to announce that any member of the lynda online training library, whether
00:05premium, monthly, or annual, has access to the exercise files used throughout this title.
00:12Naturally, the information in this course is ultimately intended to be applied to your own web pages.
00:17However, you may find it helpful to work with the supplied exercise files to practice the
00:22steps safely and without creating your own examples.
00:26To begin using the files from the site, download them, extract them, and then store those files
00:31in a convenient location such as your desktop.
00:35The Exercise Files folder is organized by chapter, and the chapters are broken down
00:40into the various lessons.
00:43Within the lesson folders there are a series of items that make up the practice files.
00:48These are typically HTML, CSS, images, JavaScript, and so forth.
00:54In most lesson folders, you'll also find a final folder, and that contains the files
00:59showing the completed lesson which you can open up and take a look at to explore at your leisure.
01:05You can either follow the whole course chapter by chapter or jump in at any point.
01:11If you'd rather not use the exercise files, you can definitely follow along with your own assets.
Collapse this transcript
Course and browser requirements
00:00To follow along with this course, the requirements are pretty straightforward.
00:04From a tools perspective, you'll need a code editor and a number of browsers for testing.
00:10You can use whichever code editor you prefer. I'm going to be working with Aptana on the Mac.
00:16It's a free editor that's available for both Mac and Windows.
00:19Most of our browser demonstration and testing will be done using pretty current versions
00:24of standard based browsers like Google Chrome.
00:27As the focus in this course is on some of the most recently released technologies,
00:33I'll point out where you might run into a problem working with the more popular recent browsers.
00:39You probably shouldn't depend on the techniques demonstrated if your client needs to support
00:44legacy browsers like Internet Explorer 6. Well, that's it for tools.
00:49From a knowledge perspective, you should be pretty familiar with both HTML and CSS, with
00:53a general understanding of JavaScript.
00:56I'll walk through any advanced JavaScript we use block by block, so you can understand
01:01what's going on under the hood.
01:03One last thing, the absolute best thing you can bring to this course is your imagination.
01:09Although I'm going to be going through all the details of applying HTML5 technologies
01:14to a specific project, you'll get the most benefit if you keep your mind open for other
01:19ways you could apply the same lessons to your own work.
Collapse this transcript
1. Understanding the Project
What we're going to build
00:00Let's take a look at the HTML5 project we're going to build.
00:05I have open index.html from the Chapter 1/01_01 folder of the exercise files.
00:13Over in the sidebar I've got a big old text banner that says Get Special Offer Here!
00:18What's not obvious to the user is that this is an HTML5 canvas element which will come into play later.
00:25For now, when the user goes to investigate and rolls over the element, it flips to display a simple form.
00:33If the user doesn't want to participate, moving away from the form flips the card back.
00:40Now let me show you what the Current TPA package offer page looks like now here.
00:46As you can see, it's a pretty basic page that lists current vacation packages.
00:50There is a little section over in the sidebar that reminds people they can get a special
00:55discount by going to the homepage. So let's go there now.
01:01This time I'll flip the card over and fill out the form.
01:05I'll leave the Gender setting at its default, and let's go a little younger on age,
01:10I'll go down to about 41, say.
01:12The slider control makes it easy for folks to pick a value and displays the selected age.
01:19Once I've selected my choices, I'll click the submit button which says Get My Special Offer.
01:26Instantly I'm taken back to the same page I was at earlier, I'll scroll down a bit so
01:30you can see that, but now there is a new element that has been added, it's an eye blazing special
01:36offer, in this case to Hike Mars for 25% off.
01:41If I had chosen female instead of male, the planet would have been Venus.
01:47And if I had chosen an age over 60, the ad would have been for me to take a tour of
01:53a planet rather than the more strenuous hiking.
01:57So what if the user isn't sure that they want to take advantage of this special offer?
02:01Well, next time they visit the homepage, the sidebar special offer section has changed.
02:08So let me go back to HOME, no longer does the sidebar contain a spinning card with a form.
02:15You'll notice there is no flipping because this particular user has already submitted their choice.
02:21Instead, it shows a reminder of their special offer which in this case is to hike Mars.
02:28This little reminder ad looks just like a premade graphic, but is actually an HTML5
02:34canvas object with several layers composited into a single image.
02:39So that's the project. Feel up to it? All right then, let's go.
Collapse this transcript
Exploring highlighted HTML5, CSS3, and JavaScript technologies
00:00In this lesson we'll take a closer look at the core technologies used to create this HTML5 project.
00:07We'll be working with four HTML5 related technologies.
00:11The range form element, localStorage, Canvas, and CSS3 transition and transform properties.
00:20Let's start with the form element range. The basic code is pretty straightforward.
00:26As you can see, it's an input type with a few additional attributes, min and max.
00:32Value serves as the default setting when the form element is first displayed.
00:37There is also an optional attribute, step, which determines the increments the slider moves.
00:42Overall, browser support is pretty goods with the exception of Firefox.
00:48You can get an up-to-date picture of browser support by going to caniuse.com and searching for range.
00:56Firefox is the last holdout and currently only displays as a standard text field.
01:02However, there is a JavaScript helper file that's available which I'll introduce you
01:07to during the course which brings Firefox into the slider camp.
01:12For our project uses and to my mind many others, there is also one big limitation to the current
01:18specification and browser implementation of the range input type.
01:23There is no associated value field to indicate which value the slider represents.
01:30Fortunately, there is a relatively easy JavaScript solution that I'll cover.
01:35Next, let's take a look at localStorage. You'll find localStorage very easy to use.
01:42One of the primary benefits of localStorage is that it provides a much needed state to
01:47websites so you can carry variables from one web page to the next, all without server side coding.
01:54localStorage is browser specific which provides a much larger storage space, 5 Megabytes versus
02:0140 Kilobytes for cookies.
02:04localStorage is set up as a name/value pair structure, so you'll need to convert any non-string formats that you use.
02:12The two most common commands are setItem and getItem.
02:17SetItem takes two arguments, the ItemName and its value, while getItem only needs
02:23the name of the item to retrieve.
02:27Browser support for localStorage is really rocking.
02:30You'll find it on caniuse.com under web storage.
02:34Canvas, our next technology brings run-time graphics to the web with a terrific degree of control.
02:43Stroke and fill are independently controlled, it can handle all primitive shapes like line,
02:48circle, and rectangle, as well as text and images.
02:53Perhaps Canvas' best feature to my mind is that it enables interactive graphics.
02:58You can as we will in this project, combine layers of graphic elements, apply graphic filters,
03:03and animate any graphic element in many ways, including moving, resizing, and rotating.
03:10Happily, Canvas has great browser support, as you can see on caniuse.com.
03:17The final bit of HTML5 related technology we'll bring in to play is CSS3 transitions and transforms.
03:24There are specs for both 2D and 3D transforms, and we'll be working with the 3D version.
03:30To use the 3D transform, you'll need to establish a 3D container as well as specify the observer placement.
03:38You'll handle both of these chores with the perspective property.
03:41We set the perspective where you want the observer-- that's the screen viewer--to observe from.
03:48There are many transform properties.
03:49In this project, we'll use one of the rotate varieties, rotateY, to accomplish our cardslip.
03:56To achieve the illusion of a 2-sided card, we'll need to set the backface-visibility property to hidden.
04:04Again, browser support is solid for CSS3 transitions and transforms.
04:10So that's a quick overview of the technologies involved in our project, and now you're ready to put them to use.
Collapse this transcript
2. Mapping the Stores
Setting up the canvas
00:00The first step in building our project is to create the initial advertisement as a canvas element.
00:07The reason it's a canvas element instead of an image is so that we can later replace what's
00:12displayed on the canvas programmatically.
00:16Working with canvas can be a little tricky, but in this course, I'm going to introduce
00:20you to an excellent helper library that greatly simplifies creating your canvas graphic.
00:26First, let's set up the necessary HTML for our canvas tag.
00:31I have opened here the index.html file from the Chapter 2/02_01 folder in my code editor.
00:40Let's scroll down to around line 40, where I have a little placeholder comment.
00:46I'll remove that comment and then add in my canvas tag.
00:51I'll give it an ID of myCanvas and then specify a width of 200 and a height also of 200.
01:05Then I'll close off the tag, and that's all we need.
01:09The way canvas works, the tag basically just reserves the space.
01:14That's why the width and height attributes are here.
01:17JavaScript is used to do the actual drawing on the blank canvas.
01:22The JavaScript syntax for canvas is not the easiest to work with, so I want to bring in
01:27a plug in called jCanvas, developed by a gentleman named Caleb Evans that makes it easy to work
01:33with Canvas in a jQuery environment.
01:36You can find out more about jCanvas, including full documentation at the URL below.
01:43I've already downloaded a copy, and now let's link to it.
01:47I'm going to scroll up to the body section, and I'll put the script tag after my existing
01:53script tags, one for jQuery, one the easing library, and one for modernizr.
02:00So let's open up our script tag, set the type equal to text/javascript, and our source
02:10is going to be equal to scripts, and within my script folder I have jcanvas.min.js.
02:17All right, let's close the tag, and now we're ready to do some drawing with JavaScript.
02:25In this case, we're just going to draw some text.
02:29So I'm going to put my new script tag after the CSS link.
02:34Again, we'll set the type to text/javascript, and I want to make a little bit of room here
02:40within my script, so I'll just open up some space, and now we'll put in the jQuery document
02:47ready function which starts off with a dollar sign and then in parenthesis the word document,
02:54followed by .ready and an open paren and the word function and another set of parentheses.
03:02Then I'll move my cursor after the set of parenthesis that follows function but before
03:07the closing parenthesis and put an opening curly brace.
03:13Aptana automatically puts the closing curly brace in for me, so I can just hit Return to
03:18open that up and put in some code.
03:20So now we can identify the canvas that we're going to draw our text on, and that's done
03:25with a dollar sign, parenthesis, quotes, and we want to target our canvas, which as
03:32you'll recall we set up with an ID of myCanvas.
03:36So put in the hash sign, myCanvas, and after the closing parenthesis, dot, and then our
03:44jCanvas function which is draw text, open that up with a set of parentheses and curly
03:52braces, again hit return so that we can enter in our Array elements.
03:58The first one is layer: true.
04:03One of the things that you always have to do in a standard JavaScript implementation
04:07of canvas is remember to draw layers.
04:11One of the nice things about jCanvas is if you're just throwing a single layer,
04:16which you often are, you can just use the attribute of layer: true in order to set that up.
04:22So I'll add a comma and then next we'll set the fill style and the fillStyle is actually
04:28the color, and we'll set that in quotes and just use our hexadecimal value of 36c, that's
04:37that kind of bright blue that you saw.
04:40We'll put a comma and then specify the font and put the string in quotes.
04:48Here we are going to specify number of font properties including its style, bold,
04:53its size, which I'll set at 32 points-- not pixels but points.
04:59That's one of the advantages of working with canvas is that you can use measurement units
05:04that are more native to drawing applications like points.
05:09I'm also going to specify the font we want, which is Trebuchet, and after that item, one more comma.
05:17Next, let's specify exactly what we want the text to say on our canvas.
05:21So I'll enter in text colon and then in quotes "Get Special Offer Here".
05:29All right, we'll put a comma.
05:32Now we need to declare where we want our text to be drawn.
05:35When you're drawing text with canvas, you specify the center point for the text to start from.
05:41Because our canvas is 200x200, the X and Y coordinates for the center point are going to be 100x100.
05:51So I'll enter x: 100, and I can just keep this on the same line, y: 100, enter another comma.
06:01Now, next I'm going to enter in a name for our layer, and this falls under the category of best practices.
06:08Sometimes you may need to target a specific layer and act upon it with JavaScript.
06:14In order to do that, it's easiest if you have a name for the layer.
06:18So I'm going to name this one startLayer, one more comma, and let's enter in a maxWidth value of 200.
06:29The maxWidth property is needed so that your text will wrap.
06:33Okay, we just need to put in a few closing , one on line 21 and one on line 22.
06:40So, let's save our page and then let's go take a look at what we have in the browser.
06:48Not bad, very clean, very simple.
06:51With the initial canvas element done, you're ready to move on to the back of the card, that's the form, next.
Collapse this transcript
Using the CSS3 range form element
00:00Form elements have been greatly enhanced under HTML5, and one of the coolest and I think
00:06most useful of them is the new range input type which converts a boring text field into a dynamic slider.
00:14In this lesson, we'll insert the necessary HTML and JavaScript for our project's complete
00:20form, including a range input.
00:23So I have the index.html file from Chapter 2/02_02 folder of my exercise files open in my code editor now.
00:33Let's tackle the HTML first.
00:35I'm going to place my form right below the first paragraph of text that appears in the
00:40aside tag on the right side of the page.
00:43So, I'm going to scroll down to around line 58 where that text is, Tell us just a little
00:50about yourself, and let's start building our form.
00:54So, I'll put in the opening form tag, and I want to give this an ID, and we'll make
01:00that ID, personalData, okay, and because forms often rely on the name attribute, I'll enter
01:09in the name attribute and give it the same value.
01:16Let's set the method to post, and we'll set the action to an empty value because we'll
01:23handle all of that processing ourselves.
01:25Okay, I'll close the opening form tag, and Aptana puts in the closing tag for me.
01:30So I'll hit Return a couple of times just to make some room.
01:33Now each of my form elements is going to be on its own paragraph line, so let's start
01:39off with a p tag, and again I'll open that up, and the first form element I'm going to
01:45put in is a radio button group.
01:47I'll be using the label tag for these, so we'll wrap it in a label tag and again make
01:54a little space for it, because I want my label to appear after the radio button, so after
02:00we've opened the label tag, I'll put in the input, and then I'm going to make the name
02:06of this equal to gender, and both the buttons in this group will have the same name.
02:14Now, let's set the type of the input tag, and we'll set that equal to radio.
02:20Now, I'm going to give it a specific ID, and this ID will be gender_0.
02:29The value will be equal to male and since I'm mostly anticipating a male audience,
02:36I'm going to make this the default value by entering the checked attribute.
02:41Okay, let's close off my input tag, and now I'll enter in the label that I'm going
02:47to use, and that is Male. Okay, that line is done.
02:52Now, to make things a little simpler, I can just copy these three lines and then paste
02:59it still within my paragraph tag, and we'll change the ID from gender_0 to gender_1, the
03:08value from male to female, remove the checked attribute, and then of course change the label from Male to Female.
03:18Okay, so our first line is done. Let's go on and create our start of our second line.
03:23Again, we'll open with our paragraph tag, make a little room, and this is where the range
03:30type input would go, but we want our label to appear first, so I'll start off with a
03:35label tag, and because we're not wrapping around the element, I'll use the for attribute,
03:42and set that to the ID of the range input type which is going to be age.
03:47Now, let's close off that opening label tag and then enter in the actual label itself which is Age.
03:54Now we are going to go to the end of the line just for readability's sake, and now we are
04:00ready to put in the actual input tag, so it's input type="range", and as I said I want
04:09to give this an ID and name of age, so we'll put in the name attribute, call it age and
04:18then the ID attribute, also call it age.
04:22There are some special elements for the range input type, one of them is the minimum value
04:27that you want, and for that we'd use the min attribute, so I'll enter min and set that
04:34equal to 18, our minimum age.
04:38Now let's also set an upper end, and we'll set the maximum equal to 98.
04:44I also get to choose where I'd like the slider to appear, and I'm going to choose a value
04:51that appears around in the middle of my slider, so we'll enter in Value="60".
04:58Now the final element for the input tag here is the onchange event.
05:04So, we'll enter in onchange, and I'm going to set this to a JavaScript function that
05:10we'll enter in, in a bit, and that custom function is called printValue, let's put in
05:16an open and close parentheses, and within it, we'll pass two arguments.
05:22First is the name of the input tag that we're pulling the value from, and that is our slider
05:29which is age, follow that with a comma and the second argument, also a string is the
05:37name of the text field that we want to bring that into, and that's going to be rangeValue.
05:44Okay, we're ready to close out our input tag.
05:49Now we also want to put on the same line, the text field that will display the number from the slider.
05:56So, I'll hit enter to create a new line, but I'm still within my paragraph tags and enter
06:02in an input tag with an ID equal to rangeValue and a type equal to text.
06:11And that's all I need for that, so let's close that tag.
06:14And we're ready to enter in our final paragraph line, I'm going to scroll down a bit here,
06:20and we'll put that after the closing paragraph tag, so there's our third and final p tag,
06:27but I want to give this a specific ID because I'll be using that for CSS purposes, and I'm
06:32going to call this buttonLine, and all that's on here is another input tag with a type of button.
06:44So we'll enter in a name.
06:48Now we also want to give it an ID equal to theButton also and the text that will appear
06:56on the button is the value, so we'll set that value to Get My Special Offer.
07:03Okay, let's close the tag and get rid of this extra little line that's crept in here.
07:10Good, our form's all done now.
07:13Next, let's bring in the JavaScript function that we referenced in the range form element.
07:18I'm going to scroll up to the head of the document and create a new line just after
07:26the close of the document ready function. This is still within the script tag.
07:33So, I'm going to put in a little comment here just so I'll remember what it's for, and this
07:38is to update the text field for the slider.
07:42Now let's create our function, enter in the keyword function, use our custom name which
07:48is printValue, with open and closed paren, and then the name for our attributes.
07:55First one is the sliderID and then whatever the textbox's ID.
08:00Now, let's do curly brace pair and within that we'll declare two variables, the first is X,
08:08and I'm going to set that to whatever the textbox object is, so "document.getElementById(textbox),
08:25close off the line with a semicolon.
08:27And now var y = almost the same thing, document .getElementById, but instead of textbox, sliderID.
08:41Now, once we have those two, we're going to set the value of one equal to the value of another.
08:48So, x.value that's the text field is going to be equal to whatever the value of Y is,
08:54which is the sliderID.
08:55Now, you recall that we set this up to trigger on change, so anytime that the slider is moved,
09:03this function will be triggered and the text field will update, that's fine, but we also
09:09have to take care of when the page loads.
09:11So I'm going to put in a window.onload function, and we'll set that equal to function, open
09:21and close parenthesis without arguments, followed by curly brace pair, and within that we'll
09:26call our printValue function, with the arguments age in single quotes followed by a comma
09:34and then also in single quotes, rangeValue, all right.
09:39We'll close everything off with a semicolon. We're far enough along to try out our work.
09:45So I'm going to save the file, and then we'll open it up in Chrome, so I'll scroll down here,
09:51so you can see my form, over on the right-hand side where I had placed it, there's
09:57our radio button group working well, but more importantly, the range input, AKA
10:03the slider control, if I drag the slider, it works perfectly and my text field is updating smoothly, excellent!
10:11Well, that's all well and good in Chrome, sliders also work well in Internet Explorer,
10:17Safari, and Opera, but what about Firefox? Let's go take a look.
10:23So, there's my radio group, but ouch!
10:27That text field is less than inspiring, it's actually pretty confusing.
10:32Now there are two text fields with the default value of 60 inside them.
10:38If I change one, let's say I change this to 45, press Tab, the text field is updated so
10:47that works, but it's a pretty lousy user experience.
10:50Luckily, while we're waiting for the Firefox team to correct this oversight,
10:56there's a developer named Frank Yan who has come to the rescue with a Javascript helper file.
11:02You can find out more about his work and download the current implementation of html5slider.js
11:09from the GitHub URL below.
11:11Now I've already downloaded my copy and placed it in my scripts folder,
11:16so all I need to do is to link to it with a script tag.
11:19I'm going to put that code right after the script tag that calls jCanvas.
11:29So we'll enter in a script tag, set the type to text/javascript and the source, src equal
11:42to scripts/html5slider.js, we'll close the script tag.
11:46Now, with that done, let's save the page again and back to Firefox, let me refresh the page,
11:55and there's our slider, excellent! Let's try it out.
12:01Okay, our slider now works as expected in the full slate of modern browsers.
12:07The form portion of our project is now complete.
Collapse this transcript
Building a flip card transition
00:00Ready for a little card flipping?
00:02In this lesson, we'll add the necessary CSS to transform our canvas text, so we can display
00:08our form by rotating along the Y axis in a smooth transition, and then we'll code the
00:14JavaScript to trigger that transformation when the user's mouse hovers over the area.
00:20I've already written out all the CSS.
00:22It's not much, but frankly because we want it to be as browser-compatible as possible, it's pretty repetitive.
00:29So I'll now link to that file and then walk you through the various declarations.
00:35I'm going to link to the transitions.css file in my styles folder.
00:40So I'll put this right after the link to main.css, and again, let's add another link tag, and
00:46we'll set the href equal to styles, and there you can see transitions.css,
00:54and we'll set the rel value equal to stylesheet and type="text/css".
01:01Okay, let's close that tag.
01:05I'll save the page, and now let's take a look at transitions.css.
01:10The first four css rules here are all for positioning, so we can just skip over those.
01:16I'm going to scroll down to around line 28, where the far more interesting CSS3 transition code really begins.
01:26The first rule on this group sets up the perspective property of the outer wrapper around the card.
01:33This is necessary to transform elements in 3D space.
01:37The actual perspective value we pass in, 800 is kind of a safe mid range that won't distort
01:43the imagery in any unwanted manner at all.
01:46Next, starting on line 36, we declare the transition property with a transform value.
01:53This makes it possible to perform the actual transformation that we'll define in the next CSS rule.
02:00In this current rule, we target the div containing the ad and the form.
02:05And the transition is set to take place over one second, that's the 1s value that you see
02:11at the end of each of declarations of the transition property.
02:16The second declaration in this rule, the transform- style defines that property to preserve the 3D space.
02:24Again, this is a necessary declaration to maintain the thee-dimensional illusion. Let's scroll down.
02:30The next rule, which starts on line 48, declares the actual transformation rotateY.
02:37As you can see, the rotation value is -180 degrees, which emulates flipping a card back and forth.
02:46The final rule ensures that the two sides of the card are completely opaque.
02:51Without declaring the backface visibility- property is hidden, the ad text on the front of the
02:56card would show through when the form was displayed, actually in reverse, which is kind
03:02of cool, but not what we want.
03:04Okay, that's all we need on the CSS side.
03:07Let's implement the JavaScript necessary to trigger our card flip.
03:11So I'll go back to index.html, and we're going to use jQuery syntax to simplify our coding.
03:19So let's put this code right at the top of our document ready function.
03:23So we want to watch for a hover event, and we want to watch a particular area.
03:30So I'll enter in a dollar sign and then open and close parentheses, single quotes,
03:35and we're going to target the class of cardGroup.flip, cardGroup is the outer container and the flip
03:43class indicates the elements to be flipped, and then after the parentheses .hover, there's
03:50our event, I'll open up a set of parentheses here and then put in function, my parentheses,
03:58and open and close curly brace, and within that, we're going to use the jQuery function
04:05ad class in order to insert a class called the flip.
04:09So I'll enter in my selector, and we're going to reference the current selector by putting
04:14in a this keyword followed by dot, and then within that we're going to look for using
04:22the find function, a class of card. Once we find that, we'll add the class theFlip.
04:32The way the hover function works in jQuery is you can define two functions, one will
04:38take effect when you hover over a particular selector and then the second one will take
04:45effect when you hover out of that selector.
04:47So let's add a comma and then function, open and closed parentheses, open and closed curly
04:56brace, and it's basically the same as we have above, $(this).find, again in single quotes
05:04.card for our class, and this time, instead of adding the class, we're going to remove
05:10the class, and that will cause with our CSS, the card to flip back.
05:18Let me put a closing semicolon here after that last parentheses.
05:24Let's save our page and see what happens.
05:26So I am going to refresh the page to get the most current view, and you can see our form
05:32disappeared, and now let's hover over the card, and we have our flip, and I move out,
05:38and it flips back, looking pretty good.
05:41The card flips one way when the user hovers over the page section and the other way when the user moves away.
05:47It's exactly what we were looking for.
05:49So this is just one of the many possible variations available to you with CSS3 transitions and transforms.
05:57Feel free to experiment and try them out on your own.
Collapse this transcript
3. Saving and Retrieving Customizations
Saving to local storage
00:00Now it's time to bring localStorage onto the stage.
00:04As noted in an earlier chapter, localStorage is an easy-to-use HTML5 feature that allows
00:10browsers to preserve the state of variables--in essence their values--from one web page to another.
00:16Until HTML5, the alternative was either to employ a server-side language like PHP or use cookies.
00:23As you're about to see, saving users choices to localStorage is extremely easy to set up, so let's get to it.
00:31So what we're going to do in this lesson is to provide the various actions that will take
00:36place once the user clicks the submit button.
00:40We'll need to get the current values of both the form elements, the radio buttons and the
00:44range slider, and save them in localStorage and then redirect the page, and we can do all that in JavaScript.
00:52So I have opened here my index.html file from the Chapter 3/03_01 folder, and I'm going to
00:59place my cursor within the jQuery document ready function. Let me scroll down a tad.
01:06And I'm going to put it right after the routine where I draw the initial Canvas.
01:10So let me just back up a little bit here and follow this pattern, put in a comment
01:17so I'll know what this is all about.
01:23So because this is jQuery, we start off with a dollar sign and then a set of parentheses
01:28and quotes, and because we're targeting our submit button, that has an ID of theButton,
01:34so we put in hash sign, theButton and then after the parentheses, dot, next the event
01:41that we want to watch for, and that's click, and we're going to be defining its functions,
01:46so we type in function and then give an open closing parentheses, and then following that
01:52a set of curly braces, so that's the basic structure of the function.
01:57Now, let's start to add in the code.
01:59First, we'll declare a couple of variables so that we can get the values of our form elements.
02:06First, what I'm going to do is for the slider, var theAge, and that is targeting the range
02:12input type which you may recall that we set as an ID of age.
02:18And because it's basically a text input, we can get the value very easily just by putting
02:24.val and then open and closing parentheses. All right, let's move on to the radio buttons.
02:32This is a little bit more complex for getting the value from, but you can still do it in a single line.
02:38These radio buttons designate the gender, so I'm going to call this variable theGender,
02:45so let's start with a dollar sign, parentheses, quotes, and now we're looking at the input
02:52tag that has a type of radio, so you do colon, radio, and we want to identify the radio group
03:00by its name, so we put that in square brackets and set it to name=gender, and then what we're
03:11really looking for is which one was selected, and if you recall, when we set up the default
03:17radio button that was male, we put the word checked as one of the attributes within the input tag.
03:24So, we'll put another colon and put the word checked.
03:28And after all of that, this is just the selector that identifies which radio button was selected,
03:36.val, open and closed parentheses.
03:40Okay, now we're ready to use those variables and put them into our localStorage.
03:47The syntax for this is very straightforward, it's localStorage with a capital S, and then
03:54the method that we want is setItem follow that by a set of parentheses, setItem takes two parameters.
04:03The first is the name of the localStorage item, and in this case, we'll continue to call
04:08it age, and I'm going to put that in quotes, use a comma to separate your two parameters
04:14and next is the value that you want to put into the age localStorage item, so that is our variable, theAge.
04:22Let's close this line with a semicolon and then one more time, we'll do a similar thing,
04:29localStorage.setItem, parentheses, here we'll be looking to store the gender that was selected
04:38so we're going to call this localStorage item gender, followed by comma and the variable
04:45that has that value, theGender.
04:47All right, after my semicolon we're ready to enter in the final line of this code, and
04:53that is a redirect. This is a basic JavaScript function, window.location.href, and we set
05:02that equal to our page. Since we're using a document-relative structure here, I can just
05:09put in offer.html and then again put in our final semicolon and the function is complete.
05:17Well, that part is done. We're all set to see how these user choices can be put to use,
05:23and we'll do that in the next lesson.
Collapse this transcript
Inserting the HTML placeholder ad
00:00In this lesson, we'll convert a standard HTML page to a dynamic one which displays a customized ad
00:07to any user who's answered our key questions.
00:11Any other user will just see the standard page with a note that they may be missing out on a special offer.
00:18To do this, it will take a little more HTML and somewhat more JavaScript.
00:23We're going to begin with the HTML, but before we do that I wanted to show you
00:27the page in a browser as it is.
00:30As you can see, it's a pretty basic page. I've just included the first of available
00:34vacations in the main content area on the left, and there's a little teaser text about
00:39the special offer on the right.
00:41We are going to insert a banner right below the navigation that spans the page to garner maximum attention.
00:48Let's head back to our code editor.
00:51So here I have offer.HTML open, that's from the Chapter 3/03_02 folder, and what I want
00:58to do is scroll down a bit. In the body of the page right after the contentWrapper div
01:05on line 27, I have a comment holding the place for my special offer.
01:10I'll remove that and start with a new div that has an ID of specialOffer.
01:22All the code in this div will provide the structure for my personalized ad.
01:27As design this special offer area has a banner that runs on the top and the bottom, and I've
01:33already set up the CSS for this, so I just need to put in a couple of empty divs.
01:38So, div, and because we are using two of these which should be a class and not an ID,
01:46and this class is called banner, and then we'll close the div, go to the end of the line.
01:52Next up are the first of three divs, all of which are variable driven.
01:56Now, were going to put in some placeholder text here which will substitute dynamically with JavaScript.
02:02So, the first div is for the text designating the action of the ad, and I call that actionText,
02:11within this div I want to put an H1 tag so we can be semantically correct, and my example
02:17action that I'll use is Tour. Okay, it's the end of that line.
02:22Now, if you're not using a code editor that provides code completion like Aptana does here,
02:27be sure to put in the closing h1 and closing div tags.
02:31Next up is the planet image, so we have another div for that with an ID equal to--you guessed it--planetImage.
02:41Here we'll put in an image tag and set the source equal to my folder images, and down
02:49here I have an image called mars_big.jpg, it's exactly what I'm looking for, and my alt text is Mars.
02:59Okay, let's close off the image tag and go down to the next line and the final variable,
03:07and this is discount.
03:08Now, discount is not a local storage variable that we're using, but I do have it set up as
03:13a variable in the JavaScript so they can be easily modified.
03:17Again, we'll put an h1 tag in here and within the h1 tag 25% Off.
03:24Now, these three divs action text, planet image, and discount, are all floated so that they'll appear in line.
03:32So, in order to clear the float, I'm going to put it another div with a class that I
03:38have set up called clearfix. This is actually a class that I used from the HTML file boilerplate
03:44code that I find works really well for clearing floats.
03:49And we'll close off of that div, and now we're ready to create a final line and put in another
03:55div with the class of banner.
03:59Let's close that div tag, and now the HTML is done.
04:04Next, you're ready to tackle the JavaScript, and we'll do that in the next lesson.
Collapse this transcript
Using JavaScript to build the ad
00:00In the previous lesson we set up all the HTML we're going to need on our offer page
00:05for our personalized ad.
00:06Now, let's go into the JavaScript. What we're going to code will retrieve the values from
00:11local storage, and if they exist, populate the personalized ad correctly.
00:18We're going to start with a script tag, and we're going to put this right before the end
00:22of the head section, and we enclose this in a script tag with a type="text/JavaScript", close
00:33our script type, and we're going to go ahead and make a little room here, and let's start
00:38our JavaScript document ready function, $(document).ready(function(),
00:50and then after the closing parentheses, an open curly brace
00:55and Aptana completes that with a closing curly brace, and now we're ready
00:59to start putting in our basic functions.
01:03First, we're going to get the items from local storage.
01:05So, let me put in a little comment to that effect, and we'll do this by declaring two
01:14variables, one for the age and one for the gender.
01:17So I'm going to call this storedAge and set that equal to localStorage.getItem, parentheses,
01:28and in quotes which item do we want to get of the two that we stored?
01:32Age, of course. Close that line with a semicolon, and then let's do the same thing but
01:37for gender, var storedGender, set that equal to localStorage.getItem("gender").
01:51So, first what we want to do is put in a if statement that will check to see if one of
01:56our local storage variables, and it doesn't matter which one.
01:59If we have one of them we have both of them, because of the way the form was set up with default values.
02:03So, let's enter in an if statement, parentheses, and what we want to check for is if the variable
02:10storedAge is not equal to null.
02:15In other words, if there is something there, and it's not null.
02:20Okay, we'll follow that with a open and close curly brace.
02:24Now the first thing were going to do is declare our variables, I have four in all,
02:30so the first one is the action, that will be the action word hike or tour.
02:36Next is the image, and this will be the source for the image, the third one is in that same
02:43image tag, and it's the image alt--that's the alt text of course--and then finally the discount.
02:50Now, as I said, this is not a variable that is used in local storage but we're going to
02:54have this set up here, go ahead and make it equal to 25% Off.
03:00So, that's string will appear as part of the personalized ad.
03:04Thus we are mixing localStorage and in-page variables.
03:10Okay, the next thing we need to is determine which values to display based on localStorage.
03:17Let me put in a comment to that effect, and we'll use an if statement here, so we want
03:27to see if stored gender is the same as male.
03:34And a set of curly braces after that if statement, and if it is we're going to set the image
03:40equal to a path to the image which is images/mars_big.jpg, close that with a semicolon, and theImageAlt,
03:54our alt text, and set that equal to Mars.
03:58Now, if it's not male, it has to be female right?
04:02So, we'll use an else statement again, a set of curly braces, and we'll set the image equal
04:13to images/venus_ big.jpg, and our ImageAlt text is going to be equal to Venus.
04:21Okay, skip down below the curly brace, it closes out that if statement and let me scroll
04:27up here so we can see better. Next, let's work with the age.
04:32Now if you recall during the introduction of a technology, I mentioned that load storage
04:38stores all of its variables as strings.
04:41So because we want to work with this as a number value, we're going to have to convert a string to a number.
04:47So, let's take that variable storedAge and set it equal to parseInt, short for parse
04:55integer and the variable we want to parse and convert from a string to a number is storedAge.
05:03Okay, once we have that, we can set up our if statement.
05:08Again, I'll scroll down so we can just focus on this.
05:11Now, in this scenario what I had figured is that if the age that they enter is 60 or less,
05:19we'll make the action hike.
05:20So, a little bit more active, and if it's over 60 we'll make the action tour.
05:26So, again, an if statement followed by parenthesis, and if storedAge our variable is less than
05:35or equal to 60--and you do not want to put this in quotes--after the closing parentheses
05:42a curly brace set, let's set the action equal to HIKE.
05:48Now, go down to where that curly brace closed after that and enter else, another set of
05:56curly braces, because if the age is not 60 or less, it has to be over, and if it is we'll
06:03set the action equal to Tour. Okay, we have all of our variables set up.
06:09So, I'm going to make a new line after that closing curly brace, and now we're ready to
06:14actually change the values.
06:16I'll add to the comment to designate with this section is about, and we're going to
06:21change the values of the image tag first using a jQuery syntax and functionality.
06:27So, let's identify that image tag where we want it to go, and it's a ID of planetImage
06:36which is the div, and we're looking at the image tag within that and then follow that
06:40with a dot and the function attr, now this stands for attributes, this is a array, so
06:48we put in a quote and then curly braces, and I'll make a little line here because we just have a couple of them.
06:55We want to change first the SRC, or source attribute, and I'm going to set that to the image.
07:03So, source, src: theImage, comma, so we can enter in our next and final attribute alt,
07:12and this is of course the ImageAlt.
07:14Okay, now I'll move down to where that curly brace and parentheses close and finish off
07:21this line with a semicolon. Next, we want to change the action text.
07:26Now, you recall that I put in an h1 tag there, so we'll target that h1 tag and use the jQuery
07:33function text to swap out the placeholder text that we have for the variable value.
07:40So, dollar sign, parentheses, quotes, actionText, and we're actually targeting not the div itself but the h1 tag.
07:51If you leave the h1 tag off, you'll find your text probably very tiny on the screen,
07:57.text, this is our function and the variable you want to use to exchange here is the action.
08:04Okay, very similar, we want to change the discount h1, again .text, parentheses, the discount.
08:15Okay, now after all of that is over, we're going to display the special area.
08:21I have a CSS rule that initially sets the display of special offer to none.
08:27Now I'm going to reveal it by using the jay query functionality of a .css function.
08:34So, let's put in our selector, which is the div specialOffer followed by .css, parentheses,
08:42and the CSS function takes two arguments whatever the property is that you want to affect,
08:49and in our case it's display, and there are always put in parentheses, followed by its value.
08:57And here the value is block.
08:58So, were doing a display block CSS rule essentially, one last closing semicolon here, and that's done.
09:07Well, now the HTML and JavaScript are complete, it's demo 30.
09:11So, I'm going to save my page and then go to the browser, and there's our personalized ad, excellent.
09:19So, at this stage, we can test the other scenarios by going back to the homepage
09:25and re-submitting a different set of answers.
09:27Let's go back here, and let's try keeping the same gender, female, and I'll increase
09:32the age this time and choose Get My Special Offer, and now instead of hiking Venus, I'm touring Venus.
09:38Great, okay, let's do one more switch just to try it out.
09:42Now, you'll notice that when I click HOME it actually resets the page so that's fine.
09:47I'm going to go ahead and bring up the age again to about where we were, 72, but we'll
09:52keep the male gender this time, get my special offer, and now instead of touring Venus, I'm touring Mars.
09:59Okay, that's really great for testing, but it's not so great for the user.
10:03You certainly don't want your user being able to go back and change the values there.
10:08We'll fix that issue in the next lesson.
Collapse this transcript
Drawing ads dynamically with Canvas
00:00We're at the culmination of our project.
00:02In this lesson, we'll bring all the various components together and use HTML5 canvas technology
00:09to dynamically compose an ad on the homepage.
00:12Essentially, we'll be leveraging everything we've done before with local storage,
00:17and I'll show you how to draw different layers on a canvass so that we can merge images
00:22with multi-layered text. Ready? Let's do it.
00:25I have index.html from the Chapter 3/03_04 folder open.
00:32All of our work in this lesson is going to take place in the script tag within the jQuery document ready function.
00:38The first thing we need to do is to retrieve our local storage variables.
00:43We'll do that right at the top of the function.
00:46So, I'm going to go after the document ready function opens, and I'm going to put in
00:51a little comment here indicating that I am going to Check for local storage, and if they exist,
00:59set the variables and hide the form. Okay, let's declare the first of two variables.
01:08We're going to use our same variables that we did before on the other page, storedAge = LocalStorage.getItem
01:16and the item we want to get is age, And we'll do the same thing for storedGender.
01:28Make sure that item is set to gender, and now we're ready for our if statement to check
01:33and see if one of the two local storage items exist.
01:36It doesn't really matter which one.
01:38I'm going to go with stored age here, so, if(storedAge !=null), meaning if there is one, curly brace.
01:49What do we want to do? Well, the way that I have my page set up,
01:54it starts off by default with a class of unsubmitted that is placed in the div that wraps around the form.
02:03That div is called special offer.
02:05So, if there are local storage variables, that means that someone has already submitted
02:09the form and is no longer unsubmitted. So, let's remove that class.
02:14So $('#specialOffer').removeClass("unsubmitted"), and we're targeting that div of special offer,
02:22and we'll use the jQuery function removeClass, again, with the parentheses and quotes, and as I said we're
02:30going to remove unsubmitted. Okay, we'll put a closing semicolon there.
02:36And the next thing we want to do is hide the detail area, that's the form.
02:41So, I'm going to put in my selector of class or .detail.css.
02:49The property we're going to change is the display property, and then we will put a comma,
02:55and we're going to set display to none.
02:58All right, our final semicolon there, and now this part of the code is done.
03:03Let me scroll the page down a bit so we can start work on the next section.
03:07Now, since we've conditionally removed the unsubmitted class, let's make the card flipping conditional.
03:13So what I am going to do is around my card flipping routine, I'm going to put an if statement,
03:21and let's put in a comment here, if form unsubmitted, do card flip and of course if it has been submitted, don't.
03:33So if, dollar sign, and we're going to target the div special offer, and you want to put your cursor
03:41after the first closing parentheses and before the second one. dot, use the jQuery function
03:47hasClass, open up another set of parentheses and quotes and enter unsubmitted.
03:56Now if that's all true, put in an open curly brace there, now Aptana automatically puts another
04:03curly brace to close off the pair.
04:05But I'm going to remove that one because I want to actually do this routine that starts
04:10on line 25 and finishes on line 32.
04:14So, I'm going to make a new line after line 32 and insert that closing curly brace.
04:17All right, so you see how these all works.
04:21If the special offer has the class of unsubmitted, meaning we're at our default state, then do
04:28the card flip, and if does not, then it won't do the flip, excellent.
04:34So, now for the big Kahuna, again, we'e going to use our local storage variables.
04:39This time we're going to determine if the initial ad should be drawn or not, and if not,
04:44what should be drawn in this place.
04:47So for this, we are going to scroll down a little bit more, and we're going to be wrapping
04:51a function around Draw initial canvas.
04:54So, I'll place my cursor after the comment and then put in my if statement,
05:00if our variable storedAge is set to null, then-- and again, we'll put in an opening curly brace--
05:10I'm going to delete the Aptana-provided closing curly brace because what
05:15I want to have happen is for this initial Get Special Offer Here! to be drawn on the canvas.
05:21All right, so let me close off the curly brace else, now if storeAge is not equal to null,
05:28in other words else open curly brace, and this is where we're going to put in all of
05:34the code where we reset the variables and bring it in and basically compose our small ad.
05:42The first thing we will need to do is to declare a couple of variables.
05:46So I'm going to declare var theText and var theImage.
05:52There are really only two separate parts to this image we're about to compose,
05:57the planet image and the text that goes on top of it.
06:01Now the text is actually multilayered, but we'll get to that in just a moment.
06:04So, we really only need the two variables.
06:06Now, let's set up our conditional.
06:09If the stored gender is male, we'll set the image to Mars, otherwise we'll set the image to Venus.
06:15So if storedGender is set to male, open that curly brace again.
06:24And we will set the image equal to images/mars.jpg.
06:31Close it with a semicolon, and now we'll enter in our else statement with its own set of
06:37curly braces otherwise, the image is going to be equal to images/venus.jpg.
06:46Okay, let's move our cursor past that closing curly brace. Now, let's deal with the storedAge.
06:52Again, we need to convert the string that is in the local variable to a number.
06:58So storedAge equals parseInt, parentheses, storedAge.
07:05You could of course just copy this code from the other page.
07:08That is pretty quick and simple to bring it in. I'm going to scroll down a bit more.
07:14Now, let's add in the conditional for the age.
07:17If storedAge is less than or equal to 60, what we do is we set the text equal to HIKE,
07:30and now I'm going to use an escape character here because with the canvas, you can't put in
07:34a line break or BR tag, so we have to put in backward slash n which puts in a new line and then 25% off.
07:45So this will allow us to stack the text HIKE 25% off and make sure the Placement is precise.
07:51All right, a closing semicolon there, and now let's put in our else condition.
07:58The text is going to be equal to TOUR\n25% off, close it with a semicolon.
08:07Okay, our variables are set up. Now, we're ready to actually construct the canvas.
08:12We'll do this with the series of three separate functions.
08:15Each using the J canvas function of add layer.
08:18So I'll target my canvas, which conveniently has an ID of myCanvas.
08:26After that I'll follow with a dot and insert the function name, addLayer, open and closed
08:31parens, open and closed curly brace, because we're working with an array.
08:36Okay, the first item in the array is identifying the type of layer that we are going to be
08:41putting in, and this is an image in single quotes, follow that by a comma.
08:47Next, we'll put in the source for this.
08:50Notice that this is not SRC, it's source, and we're going to use our variable that we have
08:56set up, starting in the routine online 48, theImage followed by a comma.
09:03Its coordinates, we want this to be dead center so we'll set the coordinates to x:100, y:100,
09:11and now this particular routine that I want to show you next is inserted in order
09:17to control the order in which things are depicted.
09:21Normally, when you add layers, they're put in top to bottom.
09:26So by my putting in the image first, and then we'll follow that up with the text, you would
09:32think that the image would be drawn and then the text layered on top of that.
09:36Well, in the perfect world, that could be, but here we are dealing with super fast computers
09:43which tend to do things very quickly.
09:46So what will happen if we don't put in this special function that I'm about to put in
09:51is all of this will happen near simultaneously and the image takes so long to load, meaning
09:58a millisecond more than a text does to be drawn is that the image will appear on top of the text.
10:04So we need to control that, and we'll do that by putting in a load property.
10:09And this is load, colon, and you follow this with a function argument function, open and
10:16close paren, and then after that the open and close curly brace, and we're targeting
10:21this particular layer, so we'll use the jQuery construct of $(this).drawLayer(1) which will
10:30be the first text layer, semicolon, and then repeat that with$ (this).drawLayer(2).
10:38So what this function is saying is control the load
10:43so that after you load and display this image, then draw layer 1 and draw layer 2.
10:51This layer that we're working with, the image layer is layer 0, so that will appear on the bottom.
10:57Okay, we go down to the closing curly brace and parentheses on line 67, add a semicolon
11:03and a line, and we're ready to move on to the next layer which is going to be a text layer.
11:09The first line is the same because we're targeting the same canvas, myCanvas, and we're adding
11:15a layer, and now this type is text, and the fill style, the color in other words,
11:25I'm going to make white.
11:26This will give a white background behind the text, so it puts a layer of white text
11:32to offset the colored text, to make sure that it shows up properly.
11:37Next our font, and we'll use the same font that we did for our initial layer, bold, 32pt,
11:44Trebuchet MS, follow that with a comma, and then the actual text that we'll put in is
11:52going to be our variable theText. Let's position that.
11:56Now instead of putting this in at 100, 100, we want it to be off set a little bit, so
12:01I'm putting it at X:101, y:101, and again we'll set the maxWidth to 200.
12:11Close that with a semicolon.
12:12All right, now because it's so similar, I can just copy this routine from line 68 to line 75.
12:22Select that, copy, paste it in, and this time we just need to change a couple things.
12:28Let's change the fill style to 36c and the X and Y coordinates to 100.
12:39Now that we have all our ad layer functions created, we need
12:44to draw them all, and to do that, we use the Jcanvas function of draw layers.
12:49So let's target our canvas, .drawLayers, close it with an open and close parentheses and a semicolon.
13:01All done, let's save the page and see what we got.
13:04So I've open the page in my browser, and because we've
13:07previously submitted the form which saves values on local storage,
13:12we now have a dynamically drawn ad. Terrific, congratulations.
13:17So one last thing before we go.
13:19Now that our conditional JavaScript is in place, how do we continue to test different
13:24submitted values or make sure that the page is working from the get-go without the form being submitted?
13:30Well, most modern browsers have a way of displaying and managing local storage items.
13:36In Chrome, go to View > Developer > Developer tools.
13:42Once the Developer tools opens up, click Resources and then over in the left column,
13:48you'll see an entry for local storage, expand that, and then click on the entry within.
13:54There are the local storage items currently stored or you can change them.
13:58Here let's change the gender from female.
14:01I'll just double-click into that and change that from female to male, and now if I go up
14:07and refresh the page, the planet changes from Venus to Mars, or you can delete them
14:12altogether and start over.
14:14So I'll select each one of these and then press the Delete key, and now when I refresh
14:19the page, I'm back to my Get Special Offer Here!
14:22My card is flipping and everything is ready to go.
14:25Not too shabby, right?
14:26So again, congratulations on completing the project.
14:30Now, go forth and personalize those ads.
Collapse this transcript
Conclusion
Next steps
00:00Thanks so much for joining me for HTML5 Projects: Personalized Ads.
00:06I hope you'll find the techniques both helpful and useful.
00:10The whole world of HTML5 technologies brings so much to the table for web designers.
00:15If you want to explore more, I have a number of courses that dive into this rich territory,
00:20all in the lynda online training library. You take care now.
Collapse this transcript


Suggested courses to watch next:

Online Marketing Fundamentals (1h 47m)
Lorrie Thomas Ross


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,069 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,024 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked