02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Creating Hot Sports on Images in HTML

After creating an image map it's time for us to create hot areas and define there %u201Chot%u201D clickable area. Some things are easier said then done so click on the pay button to see it in action.

Video Transcript

00:00So we linked our map and our image together, but we don't even know what that is
00:05So what is in a map at all a map basically enables us to create?
00:10Hotspots inside of an image in our case what we're really trying to do is we're trying to get our image
00:15To basically have like these rectangular areas that are clickable our end goal
00:20Really is that we'll be able to click on an image and then change the background of our styling
00:24That's going to be our programming task by the end of this session about mapping
00:29But the first step is to get my dad to stop sneezing so we could do this recording. Well, we'll continue
00:34What could you do? Right? All right. So let's continue. Hopefully the sneeze attack is over. So
00:40Area is the tag that we use because a map could have a lot of different hotspots
00:45so the first thing is we create an area and then in the area itself we dedicate to it a shape or
00:52It could be any number
00:55Circle polygon perfect. Exactly. So we create a shape and we define what shape we're going to be using in
01:02Our case we're going to use the rectangle shape and to do that. We're just going to write rect
01:08For rectangle once we define the rectangle we want to put out to the coordinates of that rectangle
01:14Now the way it works is and if I go back into my application is on the top corner of our image is the zero
01:21zero point the more you go to the right the more your x value grows the more you go to the bottom the more your
01:27y value grows now the values are counted in measurements of pixels because
01:35It's pixels. We're on a computer. All right, so we said it's pixels and this is position zero zero
01:40So literally we are trying to create a rectangle that would mimic this red rectangle that we have
01:44So the first step that I want to do is I want to figure out what is my first position zero zero
01:50I want to figure out what is my bottom position as well
01:52So to do that I could basically just create if I'm on a Mac I could
01:56Click on command shift for if you're on a PC
01:59You probably have to be a little do a little bit more guesstimating or find some sort of an application that does that and you'll
02:05see that we're getting the value two hundred and thirty three and
02:08two forty seven basically are that would be our second position two thirty three two forty seven
02:14So let's let's run right away before we forget it into our is our application and write our value for our coordinates
02:21by writing the property chords and
02:24Then we'll set the first value zero zero the next value after that was
02:29two
02:31thirty three and two forty
02:34seven
02:35Maybe okay, but more or less that's gonna be as good as we get now the next step after that now that we set our
02:42rectangular area that is actually going to be clickable is
02:46To set the link that it would go to so I'm gonna set my a tref
02:50And I'm gonna send my users to zero to geek comm once they click on that rectangular area
02:56Beyond that I'm also gonna give it an alternative copy just the way we did with images, and I'm just gonna say to it
03:03well
03:05Zero to geek link all right, so I'm gonna get alternative copy if I go back into my browser
03:11Click on refresh this time around if I go to the rectangular area you'll see the hand if I don't move for a while
03:17Maybe the browser will show me the alternative copy probably not in this case because we've been waiting for a while and nothing happened
03:23But if you click on the area that the the rectangular area, and you click on it
03:27It will go to zero to geek comm all right, so we're gonna
03:31Basically do the exact same thing for the next four items
03:36But you don't have to watch is doing it because it's basically going to be repetition of this first one
03:40So we're gonna take a small break and we'll fill up the information of the numbers that are supposed to come in and again
03:46What we're gonna. Do is we're gonna start from you know. Let's do one together, and then the rest will do on our own
03:51Alright, so let's copy a new area
03:53So I'm just gonna duplicate the area that we had previous and really the only thing that we're gonna be changing is the coordinates
03:58So let's think about it for a second first of all we were it originally were at zero zero
04:03That was our exposition zero, but our exposition moved from zero to two hundred and thirty three
04:08So that would be accurate. We want to start from position two thirty three because that's where we last left off
04:13But on the other hand our y position we want to reset it back to zero
04:18Now where will our X go?
04:20We don't really know yet
04:21But we do know that we want to get it all the way to the bottom just the same as it was before and really our
04:26Our question mark value is the X value itself so to figure it out
04:30I'm just gonna go back into my browser and again use that technique of command shift
04:35F4 and I was going to go for all the way from the top corner and just figure out more or less which will be
04:40481 or 480 and I could go right here and type here to
04:45481 and I just got my position to the second element as well
04:49So we actually isn't that hard for us to do it, but let's say this go back there click on refresh
04:55And now you'll see that we have our position one will position two and then position three and four and five that we didn't
05:02Create you so we're gonna stop now and in the next video
05:04We'll have these positions ready and configured and ready for us to integrate that JavaScript experience that we wanted to create
05:11So we're gonna see you in the next video once these three elements are filled up as well

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!