Skip to content

Commit

Permalink
Merge pull request #75 from Indigo744/patch-animDuration-for-legend
Browse files Browse the repository at this point in the history
Allow to set the animDuration for legend click
  • Loading branch information
neveldo committed Oct 22, 2015
2 parents 4388584 + 52eef65 commit 31ff7e3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/jquery.mapael.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,9 +1037,9 @@
, hiddenNewAttr = (hidden == 0) ? {"data-hidden": 1} : {"data-hidden": 0};

if (hidden == 0) {
label.animate({"opacity":0.5}, 300);
label.animate({"opacity":0.5}, legendOptions.hideElemsOnClick.animDuration);
} else {
label.animate({"opacity":1}, 300);
label.animate({"opacity":1}, legendOptions.hideElemsOnClick.animDuration);
}

for (var id in elems) {
Expand All @@ -1056,15 +1056,15 @@
) {
(function(id) {
if (hidden == 0) {
elems[id].mapElem.animate({"opacity":legendOptions.hideElemsOnClick.opacity}, 300, "linear", function() {(legendOptions.hideElemsOnClick.opacity == 0) && elems[id].mapElem.hide();});
elems[id].textElem && elems[id].textElem.animate({"opacity":legendOptions.hideElemsOnClick.opacity}, 300, "linear", function() {(legendOptions.hideElemsOnClick.opacity == 0) && elems[id].textElem.hide();});
elems[id].mapElem.animate({"opacity":legendOptions.hideElemsOnClick.opacity}, legendOptions.hideElemsOnClick.animDuration, "linear", function() {(legendOptions.hideElemsOnClick.opacity == 0) && elems[id].mapElem.hide();});
elems[id].textElem && elems[id].textElem.animate({"opacity":legendOptions.hideElemsOnClick.opacity}, legendOptions.hideElemsOnClick.animDuration, "linear", function() {(legendOptions.hideElemsOnClick.opacity == 0) && elems[id].textElem.hide();});
} else {
if (legendOptions.hideElemsOnClick.opacity == 0) {
elems[id].mapElem.show();
elems[id].textElem && elems[id].textElem.show();
}
elems[id].mapElem.animate({"opacity":typeof elems[id].mapElem.originalAttrs.opacity != "undefined" ? elems[id].mapElem.originalAttrs.opacity : 1}, 300);
elems[id].textElem && elems[id].textElem.animate({"opacity":typeof elems[id].textElem.originalAttrs.opacity != "undefined" ? elems[id].textElem.originalAttrs.opacity : 1}, 300);
elems[id].mapElem.animate({"opacity":typeof elems[id].mapElem.originalAttrs.opacity != "undefined" ? elems[id].mapElem.originalAttrs.opacity : 1}, legendOptions.hideElemsOnClick.animDuration);
elems[id].textElem && elems[id].textElem.animate({"opacity":typeof elems[id].textElem.originalAttrs.opacity != "undefined" ? elems[id].textElem.originalAttrs.opacity : 1}, legendOptions.hideElemsOnClick.animDuration);
}
})(id);
}
Expand Down Expand Up @@ -1431,6 +1431,7 @@
, hideElemsOnClick : {
enabled : true
, opacity : 0.2
, animDuration : 300
}
, slices : []
, mode : "vertical"
Expand Down

0 comments on commit 31ff7e3

Please sign in to comment.