Image Maps and Hot Spot Activities

Similar documents
Advanced Online Media Dr. Cindy Royal Texas State University - San Marcos School of Journalism and Mass Communication

CREATING A NEWSLETTER IN ADOBE DREAMWEAVER CS5 (step-by-step directions)

CST 150 Web Design I CSS Review - In-Class Lab

We automatically generate the HTML for this as seen below. Provide the above components for the teaser.txt file.

HTML and CSS. Elliot Davies. April 10th,

Level 1 - Clients and Markup

Chapter 1. Introduction to web development

ios App Development Using Cordova

Contents. Downloading the Data Files Centering Page Elements... 6

How To Create A Web Page On A Windows (For Free) With A Notepad) On A Macintosh (For A Freebie) Or Macintosh Web Browser (For Cheap) On Your Computer Or Macbook (

How to Add a Transparent Flash FLV movie to your Web Page Tutorial by R. Berdan Oct

Microsoft Expression Web Quickstart Guide

Responsive Web Design for Teachers. Exercise: Building a Responsive Page with the Fluid Grid Layout Feature

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Basic tutorial for Dreamweaver CS5

Links Getting Started with Widgets, Gadgets and Mobile Apps

User Guide for Smart Former Gold (v. 1.0) by IToris Inc. team

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

Terminal 4 Site Manager User Guide. Need help? Call the ITD Lab, x7471

Last week we talked about creating your own tags: div tags and span tags. A div tag goes around other tags, e.g.,:

jquery Sliding Image Gallery

ICE: HTML, CSS, and Validation

Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

WordPress and HTML Basics

OPENTABLE GROUP SEARCH MODULE GETTING STARTED ADD RESERVATIONS TO YOUR WEBSITE

Appendix H: Cascading Style Sheets (CSS)

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

Sizmek Features. Wallpaper. Build Guide

DESIGNING MOBILE FRIENDLY S

Training Studio Templates Documentation Table of Contents

Subject Tool Remarks What is JQuery. Slide Javascript Library

TUTORIAL 4 Building a Navigation Bar with Fireworks

jquery Tutorial for Beginners: Nothing But the Goods

Unlocking the Java EE Platform with HTML 5

CREATING HORIZONTAL NAVIGATION BAR USING ADOBE DREAMWEAVER CS5

JJY s Joomla 1.5 Template Design Tutorial:

Adobe Illustrator CS6. Illustrating Innovative Web Design

CS134 Web Site Design & Development. Quiz1

{color:blue; font-size: 12px;}

Create interactive web graphics out of your SAS or R datasets

Content Builder: How-To Guide

understand how image maps can enhance a design and make a site more interactive know how to create an image map easily with Dreamweaver

Contents. Introduction Downloading the Data Files... 2

Using Style Sheets for Consistency

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

Advanced Web Design. Zac Van Note.

Using Adobe Dreamweaver CS4 (10.0)

Slicing and Coding the Navigation Background in CSS

Website Builder Documentation

GEOG 351: Multimedia Cartography Lab Simon Fraser University Department of Geography Lab #1: Creating your own website

BT CONTENT SHOWCASE. JOOMLA EXTENSION User guide Version 2.1. Copyright 2013 Bowthemes Inc.

WEB DEVELOPMENT IA & IB (893 & 894)

To change title of module, click on settings

CIS 467/602-01: Data Visualization

CLASSROOM WEB DESIGNING COURSE

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

WRITE BETTER HTML BY WRITING BETTER CSS

<link rel="stylesheet" type="text/css" media="all" href="css/iphone.css" /> <!-- User defined styles -->

This document will describe how you can create your own, fully responsive. drag and drop template to use in the creator.

Coding Standards for Web Development

Contents. Launching FrontPage Working with the FrontPage Interface... 3 View Options... 4 The Folders List... 5 The Page View Frame...

Responsive Web Design Creative License

Creating Web Pages with Dreamweaver CS 6 and CSS

Using Spry Widgets. In This Chapter

How to Customize Support Portals

Web Design for Programmers. Brian Hogan NAPCS Slides and content 2008 Brian P. Hogan Do not reproduce in any form without permission

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

HOW TO CREATE AND SEND AN EXACTTARGET TEMPLATE-BASED

GUIDE TO CODE KILLER RESPONSIVE S

Designing HTML s for Use in the Advanced Editor

WebCenter User experience. John

Interactive Data Visualization for the Web Scott Murray

Building a Horizontal Menu in Dreamweaver CS3 Using Spry R. Berdan

JOOMLA 2.5 MANUAL WEBSITEDESIGN.CO.ZA

CSS for Page Layout. Key Concepts

Interactive HTML Reporting Using D3 Naushad Pasha Puliyambalath Ph.D., Nationwide Insurance, Columbus, OH

Responsive Web Design: Media Types/Media Queries/Fluid Images

WEB DESIGN COURSE CONTENT

Magic Liquidizer Documentation

Citrix StoreFront. Customizing the Receiver for Web User Interface Citrix. All rights reserved.

Differences between HTML and HTML 5

Web Development 1 A4 Project Description Web Architecture

How to make a custom Joomla template!

Chapter 1 Introduction to web development and PHP

LRB Portfolio User Guide

2011 ithemes Media LLC. All rights reserved in all media. May be shared with copyright and credit left intact

IE Class Web Design Curriculum

Web Authoring CSS. Module Descriptor

Dreamweaver. Introduction to Editing Web Pages

Web Development I & II*

Campaign Guidelines and Best Practices

BUILDING MOBILE WEB APPS WITH PHONEGAP. Matt Zukowski

Dreamweaver and Fireworks MX Integration Brian Hogan

Web Design I. Spring 2009 Kevin Cole Gallaudet University

Web Design and Development ACS Chapter 7. Working with Links

Creator Coding Guidelines Toolbox

Why? Mobile. 0Your content is no more than 3 taps away from Angry Birds. 0 Many people access your website via smartphones and other mobile devices

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

Dreamweaver CS5. Module 1: Website Development

File types There are certain image file types that can be used in a web page. They are:

Transcription:

Image Maps and Hot Spot Activities As you have learned from this week s resources, an Image Map makes it possible to define multiple clickable areas within an image. The most common use of image maps is to associate each clickable area with a web address, which opens up in a new window when clicking on it. However, it is also possible to execute a JavaScript or jquery function when clicking on each area, creating in this way a hot spot activity. In this tutorial, we will create a web page that includes a hot spot activity using an image map. A demo of this web page is located at: http://itcdland.csumb.edu/~milara/ist541/samples/hotspot/ (Notice that the mouse cursor changes automatically to a pointer when hovering over the USA, China, and India. Also, notice that a tooltip displaying the country name shows up for a few seconds when hovering over these countries.) Section 1: Preparing the Folder Structure 1. In your local computer, create a folder called hotspot 2. Inside this folder, create the folders: css, js, and img 3. Download the world map from the following link and save it within the img folder: http://itcdland.csumb.edu/~milara/ist541/samples/hotspot/img/world_map.png 4. Create a new HTML file called hotspot.html and save it within the hotspot folder. Section 2: Writing the HTML Content 1. Copy and paste the following code within the <body> tag of the hotspot.html file <div id="wrapper"> <h2>what is the country with the largest population?</h2> <h3> Click on it! </h3> <img src="img/world_map.png" width="650" height="420" alt="world Map"/> <div id="feedback"><br /></div> <br /><br /> <div style="font-size:10px">image Courtesy of the University of Texas Libraries, The University of Texas at Austin.</div><br /> </div> 1

Observe that we have included an empty div container with the id feedback. We will use it to display there the feedback based on the image areas clicked. 2. Save the file and open it in a web browser. You should be able to see the headings and the image; however, they are not centered yet. We ll center the content using CSS. Section 3: Creating the CSS file 1. Create a new file named hotpost.css and save it within the css folder. 2. Copy and paste the following CSS code: body { background: black; /* background color */ color: red; /* text color */ font-size: 12px; font-family:verdana, Geneva, sans-serif; #wrapper { width:900px; margin:0 auto; /* centers wrapper */ background: white; /* background color */ text-align:center; /* centers wrapper content */ 3. Link the external CSS file to the HTML file by entering the following line right above the closing </head> tag: <link href="css/hotspot.css" rel="stylesheet" type="text/css"> </head> <!- - You don t need to copy this line, it just shows where to copy the above line- - > 4. Save the file and open it in a web browser. The content should be displayed centered now. 2

IST541 Interactive Media Section 4: Adding the Image Map Areas Now, we will outline three clickable areas in the world map using Dreamweaver. Make sure you have watched the following video, which explains how to create image maps in Dreamweaver, before moving on: http://www.youtube.com/watch?v=sewbi5ue4o4 1. Add three polygon areas around the USA, India, and China. Do not enter anything in the Link text entry. In the Alt (alternative text) entry, enter the name of the country (see image below). 2. Since we will need to identify which area is being clicked, we need to add an id to each <area> tag. Add an id using the country as the identifier. For instance, for China the updated area tag will be: <area id="china" shape="poly" coords= "514,91,507,108,500,118,513,129,549,152,567,149,575,154,574,164,595,160,610, 165,624,155,623,138,608,118,626,110,632,100,618,84,592,75,596,90,587,105,572,108,546,104,530,90" href="#" alt="china"> 3. Add a title attribute to each area. The title allows displaying the tooltip when hovering over the clickable areas. The updated area tag for China will be: <area id="china" shape="poly" coords= "514,91,507,108,500,118,513,129,549,152,567,149,575,154,574,164,595,160,610, 165,624,155,623,138,608,118,626,110,632,100,618,84,592,75,596,90,587,105,572,108,546,104,530,90" href="#" alt="china" title="china" > 3

4. Save the file and open it in a browser. Hover over the three different clickable areas to confirm that the tooltip appears for a few seconds. So far, nothing will happen when clicking on any of the three areas. We need to add a jquery function that will check and evaluate which area was clicked on and then display the appropriate feedback. Section 4: Writing the jquery Code to Handle Clicking on the Image Map Areas In previous labs, we have written the jquery code within the HTML file itself. While this is possible, a more appropriate way is to have all the jquery code in an external file and then link to it from the HTML file (similar to the CSS files). 1. Create a new file called hotspot.js and save it within the js folder (In Dreamweaver, go to File then New and select JavaScript as the file type). 2. Add the following code to the hotspot.js file // JavaScript Document $( function() { $("map area").click( function(){ if ($(this).attr("id") == "USA") { $("#feedback").css("color","red"); $("#feedback").html("no, USA is the third one"); if ($(this).attr("id") == "China") { $("#feedback").css("color","green"); $("#feedback").html("yes, China has the largest population: 1,343,239,923"); if ($(this).attr("id") == "India") { $("#feedback").css("color","red"); $("#feedback").html("no,india is the second one"); ); ); //end main jquery function 4

Let s analyze the jquery code: The code is surrounded by the main jquery function - $(function() { The second line (highlighted in yellow) indicates that the code will be executed when clicking on a map area, that is, any <area> tag included within a <map> tag. The code surrounded by the highlighted lines includes three conditions that check the id of the map area that was clicked on. If the id is not the right answer ( China ), then we are changing to red the font color of the feedback div container: $("#feedback").css("color","red"); We are also updating the content of the feedback div container: $("#feedback").html("no, USA is the third one"); 3. Add a link to the jquery library and also a link to the hotspot.js file. To do this, copy and paste the following two lines right above the closing </head> tag: <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> <script src="js/hotspot.js"></script> 4. Save the files and open the hotspot.html file in a web browser. When clicking on any of the map areas, the corresponding feedback should be displayed. If nothing is happening when clicking on the world map: 1) Make sure you have saved the hotspot.js file within the js folder and that you re linking it properly as indicated on step 3 above (the file name is case sensitive). 2) Confirm that you have added an id to each map area in the HTML code (see the highlighted sections in the following HTML code) 5

HTML FILE: <!doctype html> <html> <head> <meta charset="utf-8"> <title>countries with Largest Population</title> </head> <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> <link rel="stylesheet" type="text/css" href="css/hotspot.css"> <script src="js/hotspot.js"></script> <body> <div id="wrapper"> <br /> <h2> What is the country with the largest population? </h2> <h3> Click on it! </h3> <img src="img/world_map.png" usemap="#map" width="650" height="420" alt="world Map"/> <map name="map"> <area id="usa" shape="rect" coords="9,87,156,143" href="#" alt="usa" title="usa"> <area id="india" shape="poly" coords="497,149,491,163,500,174,517,213,527,204,539,177,550,165,534,148,515,134,510,12 9" href="#" alt="india" title="india"> <area id="china" shape="poly" coords="514,91,507,108,500,118,513,129,549,152,567,149,575,154,574,164,595,160,610,165, 624,155,623,138,608,118,626,110,632,100,618,84,592,75,596,90,587,105,572,108,546,104,53 0,90" href="#" alt="china" title="china"> </map> <div id="feedback"><br /></div> <br /><br /> <div style="font-size:10px"> Image Courtesy of the University of Texas Libraries, The University of Texas at Austin. </div><br /> </div> </body> </html> 6