0

我已经创建了一个饼图,现在使用 ImageMapster 来设置它的样式。当我单击一块馅饼时,我希望所有其他部分都被选中(不透明度),但不是我单击的那个。

有谁知道如何做到这一点?

到目前为止我的代码:

   $('.pie').mapster({
            stroke: true,
            strokeOpacity: 1.0,
            strokeColor: '000000',
            strokeWidth: 1,
            singleSelect: true,
            fill: true,
            fillColor: '0000ff',
            fillOpacity: 0.25,

            render_select: 
            {
                fillOpacity: 0.75,
                fillColor: '000000'
            },
            render_highlight: 
            {
                fillOpacity: 0.5,
                fillColor: '00ff00'
            },
            onClick: function(e) { 

                // Select all pies but not this one.
                $('.pie area').mapster('select');
            }
    });
4

1 回答 1

2

这应该有效:

onClick: function(e) { 
    // unselect the clicked one
    $(this).mapster('deselect');

    // Select all pies but not this one.
     $('.pie area').not(this).mapster('select');

    // prevent default click handling
    return false;
}
于 2013-04-16T14:41:42.063 回答