鼠标单击时如何为div的每个外观添加fadeIn()效果?

因此,在onmouseclick上,黄色部分显示为fadeIn()效果。

小提琴:http://jsfiddle.net/2ehdW/7/

剧本:

window.jQueryclick: function (event) {
    if (!event.point.selected) {
        $('#testDiv').show();
        var chart_data = '<div> Name: ' + event.point.name + ' Share: ' + event.point.y + '</div>';
        $('#testDiv').html(chart_data);
    } else {
        $('#testDiv').hide();
    }
}

最佳答案

将参数添加到.show()方法并隐藏div,然后再次显示它:

if (!event.point.selected) {
   $('#testDiv').hide();
   $('#testDiv').show("300"); //or just $('#testDiv').fadeIn();
   var chart_data = 'Name: ' + event.point.name + ' Share: ' + event.point.y;
   $('#testDiv').html(chart_data);
} else {
   $('#testDiv').hide();
}


FIDDLE

09-25 19:16