I've been trying to create a fancy image map for my website, which is built using ASP.Net MVC2 Razor C#. I came across this page: http://davidlynch.org/projects/maphilight/docs/ which was basically perfect for what I needed. Taught me a lot about how to setup etc in HTML which I wasn't familiar with.
Issue is I cannot seem to get it to work in my MVC website. Note: This website was built using the Microsoft template in Visual Web Developer 2010.
I've downloaded both the jquery.maphilight.min.js and jquery.maphilight.js Scripts and added to my scripts folder. I've also added them to my main _Layout.cshtml file here:
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/lightbox.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/lightbox.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.maphilight.js")" type="text/javascript"></script>
</head>
I then tried to call the script in my View:
@{
ViewBag.Title = "Course Map";
}
<fieldset>
<legend>Course Map </legend>
<div id="course_map">
<img src="../../images/cmap.gif" width="500" height="421" alt="Insert Alt" usemap="#image_map"
border="0">
<map name="image_map" id="image_map">
<area href="#" title="SC" shape="poly" coords="348,213, 340,207, 338,204, 338,200, 340,196, 338,192, 335,190, 336,183, 338,178, 342,176, 347,175, 348,170, 355,170, 361,174, 362,184, 362,194, 366,200, 366,206, 369,212, 371,217, 368,222, 367,228, 369,234, 367,241, 361,243, 356,240, 352,236, 348,236, 345,231, 344,225, 346,221, 349,216" />
</map>
</div>
<script type="text/javascript"> $(function () {
$('.map').maphilight({ fade: false });
});
</script>
</fieldset>
The Image map coords work fine, but I don't get any fancy highlighting as demo'd in David's site. I'm fairly sure I've cocked up with how I'm calling the Javascript etc, but unsure what I've done wrong.
Appreciate any help - thanks.