Javascript jQuery toggle()setInterval不工作
我有这个:Javascript jQuery toggle()setInterval不工作,javascript,jquery,Javascript,Jquery,我有这个: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="con
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link href="http://fonts.googleapis.com/css?family=Geo:regular" rel="stylesheet" type="text/css" >
<style>
body {
font-family: 'Geo', serif;
font-size: 32px;
font-style: normal;
font-weight: 400;
text-shadow: none;
text-decoration: none;
text-transform: none;
letter-spacing: 0em;
word-spacing: 0em;
line-height: 1.2;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript">
function cursorAnimation()
{
$(".cursor").toggle();
}
$(document).ready(function()
{
setInterval ( "cursorAnimation()", 1900);
});
</script>
<title>Untitled 2</title>
</head>
<body>
So, what's the deal?<span class="cursor">[WARNING]</span>
</body>
</html>
身体{
字体系列:“Geo”,衬线;
字体大小:32px;
字体风格:普通;
字体大小:400;
文本阴影:无;
文字装饰:无;
文本转换:无;
字母间距:0em;
字距:0em;
线高:1.2;
}
函数游标动画()
{
$(“.cursor”).toggle();
}
$(文档).ready(函数()
{
setInterval(“游标动画()”,1900);
});
无标题2
那么,这是怎么回事?[警告]
从技术上讲,它是有效的。不过,切换正在工作,但速度太快了。我试过搞乱setInterval,但它没有做什么该死的事。。。我只想让它在循环中出现和消失(像光标一样),但不会褪色。尝试设置间隔(cursorAnimation,1900) 它就像小提琴一样好用,所以我想知道发生了什么事 我将其更改为fadeToggle()以使其不那么“困难”
setInterval(function cursorAnimation() {
$('.cursor').fadeToggle(); }, 1900);
对不起,那就不确定了!它是否像您希望的那样在JSFIDLE中工作?对我来说,它的工作原理是可以预测的,每1.9秒发射一次。我不确定你的意思,它似乎很好:更改setInterval的第二个参数会改变闪烁的速度。它的工作原理似乎和你想要的一样(FF4.0.1,Win7上的Chrome 11)。你确定你有
1900
而不是190
?