I have an image and i want to highlight specific area of the image using jquery but you can not use imagemap control or map tag of html. I am able to show a div on the specific area of the image but is not able to highlight that area (need to set boarder or something like that which will make it highlighted). Here is an little idea how i did that i found coordinator on mouse move event and made a condition if let suppose x>214 and y<250 then another div should display.....Now how can i highlight that specific area by using jquery.... i want to clear the thing actually suppose you have created a rectangle(logically) box by getting coordinator so when i move mouse on that rectangle another div is displaying but that rectangle should be highlighted..... Please Help开发者_如何学编程 me. Thanks in Advance!!!!!!
SUCCESS:--- Got success dude, thanks for your efforts. actually i did it now through map tag and is working fine........
Well, you didn't sound very clear...but I would do it like this:
var myImage = $("#myImage");
var imageOffset = myImage.offset();
var highlight = $("<div />", {
css: {
"background-color":"blue",
"opacity":"0.5"
}
});
//Highlight a quarter of image in an opaque blue
highlight.appendTo("body");
highlight.height(myImage.height()/2);
highlight.width(myImage.width()/2);
highlight.offset(imageOffset);
You can do it in less code than that if you chain them.
精彩评论