Mos*_*she 3 javascript jquery google-chrome cross-browser
我使用jQuery 1.3.2和jQuery颜色插件在jQuery中设置了一个元素.我同时为'color'和'backgroundColor'属性设置了动画.在IE8和FF中它工作得很好.Chrome动画鼠标悬停颜色,然后停止.背景保持不变,鼠标输出没有取消应有的效果.
Chrome的开发人员工具说明了一些未定义的内容.我知道我在这里有点模糊,也许这是一个众所周知的问题?
编辑 - 代码(最后!):
<script>
$(document).ready(function(event){
$(".nav a").hover(function(event){
$(this).animate({"color":"#FFFFFF", "backgroundColor":"#3AB7FF"}, 900);
},function(event){
$(this).animate({"color":"#98DCFF","backgroundColor":"#FFFFFF"}, 900);
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
编辑:
@Bernhard Hofmann - 您的意思是"您选择的属性的问题"?请详细说明.
Chrome似乎与您选择的属性存在一些问题.我设法使用鼠标在Chrome中输入和离开事件来使动画工作.这是脚本和标记,适合那些想要摆弄和放手的人.
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(event){
$(".nav a").
mouseenter(function(){$(this).animate({fontSize:"2em"}, 900);}).
mouseleave(function(){$(this).animate({fontSize:"1em"}, 900);});
/*
$(".nav a").hover(function(){
$(this).animate({"color":"#FFFFFF", "backgroundColor":"#3AB7FF"}, 900);
},function(){
$(this).animate({"color":"#98DCFF","backgroundColor":"#FFFFFF"}, 900);
});
*/
});
</script>
</head>
<body>
<div class="nav" style="color:#000;background:#cfc;padding:2em 2em 2em 2em;margin:2em 2em 2em 2em;">
<a href="http://stackoverflow.com/questions/2010576/jquery-animation-issue-in-chrome" id="a1">StackOverflow</a>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9279 次 |
最近记录: |