Files
iD/js/id/ui/modal.js
Tom MacWright 49897680f7 Use a selection for remove. Fixes #305.
The story behind this one is that Chrome 24+ has a built-in .remove()
function on all elements which does the trick of fooling me into
thinking that this was a selection. It isn't, and this makes it one.
2012-12-27 17:46:28 -05:00

27 lines
662 B
JavaScript

iD.modal = function() {
var animate = d3.select('div.modal').empty();
d3.select('div.modal').transition()
.style('opacity', 0).remove();
var shaded = d3.select(document.body)
.append('div').attr('class', 'shaded')
.style('opacity', 0)
.on('click.remove-modal', function() {
if (d3.event.target == this) d3.select(this).remove();
});
shaded.append('div')
.attr('class', 'modal')
.append('div')
.attr('class', 'content');
if (animate) {
shaded.transition().style('opacity', 1);
} else {
shaded.style('opacity', 1);
}
return shaded;
};