0

我在 svg 元素上使用 jquery 的隐藏功能,除非我尝试指定持续时间,否则它工作正常:

// Hide the object: works fine
$('#id').hide()

// Doesn't work with time specified in any of these attempts including fadeout
$('#id').hide('slow')
$('#id').hide(400)
$('#id').hide(400, function() {console.log('done')})
$('#id').fadeOut()
$('#id').fadeOut(400)

编辑:这是控制台显示的内容:

// Works
$('#HTI2010').hide()
[
<circle cx=​"50" cy=​"450" id=​"HTI2010" r=​"10" class=​"c2010" title style=​"display:​ none;​ ">​&lt;/circle>​
]

// Doesn't work: display is set to in-line instead of none:  is there an argument I can alter to change this?

$('#HTI2010').hide(400)
[
<circle cx=​"50" cy=​"450" id=​"HTI2010" r=​"10" class=​"c2010" title style=​"display:​ inline;​ ">​&lt;/circle>​
]

对于这些,对象保留在屏幕上。我错过了什么吗?谢谢,

4

1 回答 1

0

试试这个:

var duration = 400;

$('#id').hide(duration);
于 2016-09-21T06:00:11.047 回答