Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SVG image markers #400

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/jvectormap.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,18 @@ var jvm = {

whenImageLoaded: function(url){
var deferred = new jvm.$.Deferred(),
img = jvm.$('<img/>');
img = jvm.$('<img style="position: aboslute; left:\'-999em;\'"/>');

img.error(function(){
deferred.reject();
}).load(function(){
deferred.resolve(img);
// If the client is using IE width of IMG can not
// be retrieved when src is an SVG, so we need to
// add the element to the body for a short while
if (img[0].width === 0 && img[0].height === 0)
img.appendTo(document.body);
deferred.resolve(img);
img.detach();
});
img.attr('src', url);

Expand Down Expand Up @@ -182,4 +188,4 @@ if (!Array.prototype.indexOf) {
}
return -1;
};
}
}