图像翻转和动画帮助需要jquery
image rollover over, and animation help needed jquery
我已经分别测试了我的两个功能,但是当我把它们放在一起时,它们不起作用。一种是图像翻转,允许用户将鼠标移到上方并查看更大的图像。另一个是简单的动画,将图像边框周围的橙色变为黑色。我也想知道是否有人对如何让图像在放大时不失去像素化有任何想法。这是动态完成的,所以我不能为每个图像创建两个图像。提前感谢。这是我的代码。该页面最终将有多达250行图像。
<!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=iso-8859-1" />
<title></title>
<style type="text/css">
.container {
width: 400px;
position: absolute;
margin-top:40px;
margin-left:40px;
}
ul.thumb {
float: left;
list-style: none;
width: 400px;
}
ul.thumb li {
float: left;
position: relative;
width: 80px;
height: 60px;
}
ul.thumb li img {
width: 80px; height: 60px;
position: absolute;
left: 0; top: 0;
-ms-interpolation-mode: bicubic;
}
.images {
border: 5px solid;
}
</style>
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://ditio.net/wp-content/uploads/2010/01/jquery-resize.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".images").each(function setAnim() {
$(this).
animate({
borderTopColor:'orange',
borderRightColor:'orange',
borderBottomColor:'orange',
borderLeftColor:'orange',
}, 1000).
animate({
borderTopColor:'black',
borderRightColor:'black',
borderBottomColor:'black',
borderLeftColor:'black'}, 1000, setAnim);
});
});
//Larger thumbnail preview
$("ul.thumb li").hover(function() {
$(this).css({'z-index' : '10'});
$(this).find('img').addClass("hover").stop()
.animate({
marginTop: '-80px',
marginLeft: '-80px',
top: '50%',
left: '50%',
width: '160px',
height: '120px',
}, 200);
} , function() {
$(this).css({'z-index' : '0'});
$(this).find('img').removeClass("hover").stop()
.animate({
marginTop: '0',
marginLeft: '0',
top: '0',
left: '0',
width: '80px',
height: '60px',
}, 400);
});
</script>
</head>
<body>
<div class="container">
<ul class="thumb">
<li><a href="test.html"><img src="images/desert.jpg" class="images" alt="" /></a></li>
<li><a href="test.html"><img src="images/flower.jpg" class="images" alt="" /></a></li>
<li><a href="test.html"><img src="images/jellyfish.jpg" class="images" alt="" /></a></li>
</ul>
<ul class="thumb">
<li><a href="test.html"><img src="images/desert.jpg" class="images" alt="" /></a></li>
<li><a href="test.html"><img src="images/flower.jpg" class="images" alt="" /></a></li>
<li><a href="test.html"><img src="images/jellyfish.jpg" class="images" alt="" /></a></li>
</ul>
</div>
</body>
</html>
试试这个,我还注意到你有一些你不应该有的逗号:
$(function() {
$(".images").each(function() {
$(this).animate({
borderTopColor: 'orange',
borderRightColor: 'orange',
borderBottomColor: 'orange',
borderLeftColor: 'orange'
}, 1000).animate({
borderTopColor: 'black',
borderRightColor: 'black',
borderBottomColor: 'black',
borderLeftColor: 'black'
}, 1000);
});
});
//Larger thumbnail preview
$("ul.thumb li").hover(function() {
$(this).css({'z-index': '10'});
$(this).find('img').addClass("hover").stop().animate({
marginTop: '-80px',
marginLeft: '-80px',
top: '50%',
left: '50%',
width: '160px',
height: '120px'
}, 200);
}, function() {
$(this).css({'z-index': '0'});
$(this).find('img').removeClass("hover").stop().animate({
marginTop: '0',
marginLeft: '0',
top: '0',
left: '0',
width: '80px',
height: '60px'
}, 400);
});
相关文章:
- ColorBox jQuery帮助请求
- 需要 jQuery 帮助将类添加到对象数组
- jQuery帮助获取包含特定类的数组中的元素
- 点击jQuery帮助推特引导多个下拉菜单
- Jquery帮助,点击,使其他人变暗
- jQuery帮助在Textarea中添加和删除元素
- jQuery帮助取消勾选父,我需要切换孩子复选框
- 我需要在jquery帮助,使数组的项目名称
- Jquery帮助需要Div的高度
- Javascript / Jquery帮助-从选择菜单调用函数
- JS/jQuery:帮助修改代码来替换4张图片
- Jquery帮助添加ajax功能的输入字段
- Jquery帮助检查和取消标签点击
- Jquery帮助与返回到顶部
- jQuery帮助:如何选择第n行
- Jquery帮助重复ajax调用
- Jquery帮助选择输入字段
- Jquery帮助追加HTML不工作
- Jquery帮助插入HTML
- Jquery帮助创建基于另一个输入字段