我在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; "></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; "></circle>
]
对象仍保留在屏幕上。我错过了什么吗?谢谢,
答案 0 :(得分:0)
请改为尝试:
var duration = 400;
$('#id').hide(duration);