jQuery 效果、动画和 CSS
我正在尝试在鼠标悬停时获得平滑的 jquery 动画(通过淡入/淡出等动画扩展潜水平滑)效果。
我已经在下面的代码中使用绿色层上的 css 完成了此操作,但无法实现 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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<style>
.box1{
width:40px;
height:13px;
float:left;
font-size:.6em; color:#fff; background:#99CC00;
font-family:Arial, Helvetica, sans-serif;
z-index:1;
overflow:hidden;
}
.box1:hover{
width:200px;
float:left;
height:125px;
z-index:99999999;
position:relative;
cursor:default;
opacity:.8;
filter: alpha(opacity=75);
overflow:visible;
}
.box2{
width:40px;
height:auto;
float:left;
font-size:.6em; color:#fff; background:#FF6600;
font-family:Arial, Helvetica, sans-serif;
margin-top:1px;
opacity:.8;
filter: alpha(opacity=75);
}
.box2:hover{
width:200px;
float:left;
height:125px;
position:relative;
}
</style>
</head>
<body>
<table width="160" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" height="40" valign="top" bgcolor="#e4e4e4">
<table width="40" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div style="width:40px; height:auto; float:left; position:absolute;">
<span class="box1">Hello <ul><li>Sanket</li><li>Pratp</li><li>Deora</li></ul></span>
</div>
</td>
</tr>
<tr>
<td><div style="width:40px; height:auto; float:left; position:absolute; top:21px;"><span class="box2">Sanket</span></div></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</td>
<td width="40" height="40" valign="top" bgcolor="#CCCCCC"> </td>
<td width="40" height="40" valign="top" bgcolor="#999999"> </td>
<td width="40" height="40" valign="top" bgcolor="#666666"> </td>
</tr>
<tr>
<td width="40" height="40" valign="top" bgcolor="#666666"> </td>
<td width="40" height="40" valign="top" bgcolor="#999999"> </td>
<td width="40" height="40" valign="top" bgcolor="#CCCCCC"> </td>
<td width="40" height="40" valign="top" bgcolor="#E4E4E4"> </td>
</tr>
<tr>
<td width="40" height="40" valign="top" bgcolor="#E4E4E4"> </td>
<td width="40" height="40" valign="top" bgcolor="#CCCCCC"> </td>
<td width="40" height="40" valign="top" bgcolor="#999999"> </td>
<td width="40" height="40" valign="top" bgcolor="#666666"> </td>
</tr>
<tr>
<td width="40" height="40" valign="top" bgcolor="#666666"> </td>
<td width="40" height="40" valign="top" bgcolor="#999999"> </td>
<td width="40" height="40" valign="top" bgcolor="#CCCCCC"> </td>
<td width="40" height="40" valign="top" bgcolor="#E4E4E4"> </td>
</tr>
</table>
</body>
</html>
我是 jquery 的新手,非常感谢您的帮助。
I am trying you get a smooth jquery animate (expand dive smooth with animation like fade-in/out ) effect on mouse hover.
I have done this using css on green layer in below code but not able to implement Jquery smooth animation effect as i mention above lines.
Here is my simple code.
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<style>
.box1{
width:40px;
height:13px;
float:left;
font-size:.6em; color:#fff; background:#99CC00;
font-family:Arial, Helvetica, sans-serif;
z-index:1;
overflow:hidden;
}
.box1:hover{
width:200px;
float:left;
height:125px;
z-index:99999999;
position:relative;
cursor:default;
opacity:.8;
filter: alpha(opacity=75);
overflow:visible;
}
.box2{
width:40px;
height:auto;
float:left;
font-size:.6em; color:#fff; background:#FF6600;
font-family:Arial, Helvetica, sans-serif;
margin-top:1px;
opacity:.8;
filter: alpha(opacity=75);
}
.box2:hover{
width:200px;
float:left;
height:125px;
position:relative;
}
</style>
</head>
<body>
<table width="160" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" height="40" valign="top" bgcolor="#e4e4e4">
<table width="40" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div style="width:40px; height:auto; float:left; position:absolute;">
<span class="box1">Hello <ul><li>Sanket</li><li>Pratp</li><li>Deora</li></ul></span>
</div>
</td>
</tr>
<tr>
<td><div style="width:40px; height:auto; float:left; position:absolute; top:21px;"><span class="box2">Sanket</span></div></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</td>
<td width="40" height="40" valign="top" bgcolor="#CCCCCC"> </td>
<td width="40" height="40" valign="top" bgcolor="#999999"> </td>
<td width="40" height="40" valign="top" bgcolor="#666666"> </td>
</tr>
<tr>
<td width="40" height="40" valign="top" bgcolor="#666666"> </td>
<td width="40" height="40" valign="top" bgcolor="#999999"> </td>
<td width="40" height="40" valign="top" bgcolor="#CCCCCC"> </td>
<td width="40" height="40" valign="top" bgcolor="#E4E4E4"> </td>
</tr>
<tr>
<td width="40" height="40" valign="top" bgcolor="#E4E4E4"> </td>
<td width="40" height="40" valign="top" bgcolor="#CCCCCC"> </td>
<td width="40" height="40" valign="top" bgcolor="#999999"> </td>
<td width="40" height="40" valign="top" bgcolor="#666666"> </td>
</tr>
<tr>
<td width="40" height="40" valign="top" bgcolor="#666666"> </td>
<td width="40" height="40" valign="top" bgcolor="#999999"> </td>
<td width="40" height="40" valign="top" bgcolor="#CCCCCC"> </td>
<td width="40" height="40" valign="top" bgcolor="#E4E4E4"> </td>
</tr>
</table>
</body>
</html>
I am new to jquery, help much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的问题与此非常相似: jQuery.animate()仅使用 css 类,没有显式样式
或者您可以简单地使用此插件:http://code.google.com/p/jq-class-anim/
Your question is pretty similar to this one: jQuery.animate() with css class only, without explicit styles
Or you can simply use this plugin: http://code.google.com/p/jq-class-anim/
你可以做 lyk dis ...只是一个解释事情的例子
You can do lyk dis ...just an example to explain things
请随意在最近的项目(成人网站)中查看它的版本,只需单击搜索:
fuckedapps.com
Feel free to see a version of it in a recent project (adult site), just click on search:
fuckedapps.com