Reputation: 144
I am Using jquery how can I trigger an alert when mouseover the element with the data-code=GB atribute?
I tried this with no luck...
$(".jvectormap-container path[data-code='GB']").mouseover(function(){
alert('test');
});
Thank you
Upvotes: 1
Views: 269
Reputation: 22943
Why not to use standard parameter of the jVectorMap onRegionOver
? Your code won't work in IE, because there are no path
element in IE, it uses shape
instead.
Upvotes: 1
Reputation: 55740
Try this
$(function() {
$(".jvectormap-container").filter("path[data-code='GB']").on('mouseover',function(){
alert('test');
});
});
Upvotes: 0
Reputation: 1402
With slight modification, its working for me. I added -
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.jvectormap-container path[data-code="GB"]').bind('mouseover', function(){
alert('test');
});
});
</script>
</head>
Working copy is here: http://jsbin.com/uwatiz/5/edit
Upvotes: 1
Reputation: 76
You have the path inside a div. Which is something wrong. With proper usage of path your js code works fine.
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="jvectormap-container">
<path d="M150 0 L75 200 L225 200 Z" data-code='GB' />
</svg>
Upvotes: 0