jQuery CSS3 照片墙

<html>
<head>
<style type="text/css">
.picture-wall-container{
position: relative;
margin:100px;
}
.picture{
position: absolute;
padding:5px;
background-color: white;
box-shadow: gray 1px 1px 1px;
transition:transform 0.3s;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<div class="picture-wall-container">
<img id="picture-1" class="picture" src="imgs/1.png" />
<img id="picture-2" class="picture" src="imgs/2.png" />
<img id="picture-3" class="picture" src="imgs/3.png" />
<img id="picture-4" class="picture" src="imgs/4.png" />
<img id="picture-5" class="picture" src="imgs/5.png" /> <img id="picture-6" class="picture" src="imgs/6.png" />
<img id="picture-7" class="picture" src="imgs/7.png" />
<img id="picture-8" class="picture" src="imgs/8.png" />
<img id="picture-9" class="picture" src="imgs/9.png" />
<img id="picture-10" class="picture" src="imgs/10.png" /> <img id="picture-11" class="picture" src="imgs/11.png" />
<img id="picture-12" class="picture" src="imgs/12.png" />
<img id="picture-13" class="picture" src="imgs/13.png" />
<img id="picture-14" class="picture" src="imgs/14.png" />
<img id="picture-15" class="picture" src="imgs/15.png" />
</div>
<script type="text/javascript">
function getRandom(min, max){
var r = Math.random()*(max-min)+min;
r = Math.ceil(r);
return r;
}
$(document).ready(function(){
var hcount = 5;
var vcount = 3;
var picWidth = 300;
var picHeight = 200;
var left = 0;
var top = 0;
var angles = [];
var zindexs = [];
for(var i = 1; i <= 5;i++){
left = left + picWidth - picWidth/3;
if(i == 1){
left = 0;
}
var picid = "#picture-" + i;
var zindex = getRandom(0,10)%3+1;
var angle = getRandom(5, 15);
var d = getRandom(0, 10);
if(d<=5){
angle *= -1;
}
$(picid).css({"left":left+"px","top":top+"px","z-index":zindex,"transform":"rotate("+angle+"deg)"});
}
left = 0;
top = 2*picHeight/3;
for(i=6;i<=10;i++){
left = left + picWidth - picWidth/3;
if(i== 6){
left = 0;
}
picid="#picture-"+i;
zindex = getRandom(0,10)%3+1;
angle = getRandom(5, 15);
d = getRandom(0, 10);
if(d<=5){
angle *= -1;
}
$(picid).css({"left":left+"px","top":top+"px","z-index":zindex,"transform":"rotate("+angle+"deg)"});
}
left = 0;
top = 4*picHeight/3;
for(i=11;i<=15;i++){
left = left + picWidth - picWidth/3;
if(i== 11){
left = 0;
}
picid="#picture-"+i;
zindex = getRandom(0,10)%3+1;
angle = getRandom(5, 15);
d = getRandom(0, 10);
if(d<=5){
angle *= -1;
}
$(picid).css({"left":left+"px","top":top+"px","z-index":zindex,"transform":"rotate("+angle+"deg)"});
}
$(".picture").each(function(index, item){
$(this).hover(function(){
angles[index] = $(this).css("transform");
zindexs[index] = $(this).css("z-index");
$(this).css({"z-index":4,"transform":"rotate(0deg)"});
},function(){
$(this).css({"z-index":zindexs[index],"transform":angles[index]});
});
});
});
</script>
</body>
</html>
jQuery CSS3 照片墙的更多相关文章
- css3照片墙+曲线阴影
css3照片墙+曲线阴影 最近在学习jquery,晚上想复习下以前学过的知识,看到网上有关于css3照片墙的,感觉挺好玩的,就做了做.(以下图片均来自网络) 一.css3照片墙 html部分: < ...
- jQuery+CSS3文字跑马灯特效
jQuery+CSS3文字跑马灯特效是一款将跑马灯背景制作为3D立方体效果,文字在上面移动时,就像是文字投影到墙壁上,在转角出会改变运动方向. 效果展示 http://hovertree.com/te ...
- jquery css3问卷答题卡翻页动画效果
这个选项调查的特效以选项卡的形式,每答完一道题目自动切换到下一条,颇具特色.使用jQuery和CSS3,适合HTML5浏览器. 效果展示 http://hovertree.com/texiao/jqu ...
- jQuery css3鼠标悬停图片显示遮罩层动画特效
jQuery css3鼠标悬停图片显示遮罩层动画特效 效果体验:http://hovertree.com/texiao/jquery/39/ 效果图: 源码下载:http://hovertree.co ...
- 使用 jQuery & CSS3 制作美丽的照片画廊
在本教程中,我们将创建一个很好看的照片画廊效果.我们的想法是,以显示专辑作为一个滑块,而当这张专辑被选中,我们将使用一个美丽的照片堆栈展示专辑的图像.在照片堆栈视图,我们可以通过将最上面的图像移动到所 ...
- jQuery+css3 弹幕
写了个基于jQuery+css3的弹幕功能,此功能面向手机wap,利用改变位移做弹幕功能会使一些性能低的手机浏览器卡,所以用了css3,此功能不支持非webkit内核浏览器 html部分 自己设置样式 ...
- Image Wall - jQuery & CSS3 图片墙效果
今天我们要为您展示如何基于 jQuery 和 CSS3 创建一个整洁的图片墙效果.我们的想法是在页面上洒上一些大小不同的缩略图,并在当我们点击图片时候显示丝带,会显示一些描述,再次点击缩略图时,丝带将 ...
- 学习使用 jQuery & CSS3 制作照片堆栈效果
在这个小实验中,我们使用 jQuery & CSS3 创建了一个交互式的照片堆栈效果.提供了一些模拟现实的互动的可能性给用户.这个想法的思路是:有一些照片在桌面上可以拖放一样,堆放和删除,每个 ...
- 使用 jQuery & CSS3 实现翻转的作品集滑块
作为 Web 开发人员,我想你一定见过各种各样的图片滑块效果.展示产品或者个人作品的方法有很多,其中之一是使用网格样式的滑块效果.在本教程中,我将分享如何使用 jQuery 和 CSS3 变换实现翻转 ...
随机推荐
- Best Time to Buy and Sell Stock II ——LeetCode
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...
- Java的内存管理与内存泄露
作为Internet最流行的编程语言之一,Java现正非常流行.我们的网络应用程序就主要采用Java语言开发,大体上分为客户端.服务器和数据库三个层次.在进入测试过程中,我们发现有一个程序模块系统内存 ...
- perl中执行linux命令,及其区别
1. system("date '+%Y-%m-%d %H:%M:%S'") 该命令返回的是-1.(应该是date命令的main函数的返回值) 2. `date '+%Y-%m-% ...
- 大龄剩女四大结局:孤寡 后妈 拉拉 出家 宽带山KDS-宽带山社区-第一城市消费门户
大龄剩女四大结局:孤寡 后妈 拉拉 出家 宽带山KDS-宽带山社区-第一城市消费门户 主题:大龄剩女四大结局:孤寡 后妈 拉拉 出家
- .Hibernate一对一映射与组件映射
1.按照外键映射(Hibernate提供了两种映射一对一关联关系的方式:按照外键映射和按照主键映射) 实现需要: 创建实体类Users1和Resume1 public class Users1 { p ...
- Spring 3 来创建 RESTful Web Services
Spring 3 创建 RESTful Web Services 在 Java™ 中,您可以使用以下几种方法来创建 RESTful Web Service:使用 JSR 311(311)及其参考实现 ...
- Unity3D基础学习 加载场景时隐藏物体,点击显示时显示物体
隐藏物体有两种方法,一是设置Meshrender为False,即不渲染物体. 二是设置物体为False,禁用物体,我使用的第二种. 当场景中需要隐藏的物体很多时,我们可以添加一个层来表示需要隐藏的物体 ...
- Microsoft Dynamics CRM4.0编程---说明
Introduction(说明) If your organization has customers, you need a software system to help you manage y ...
- Xcode HeaderDoc 教程(2)
Code Snippets,让一切变得更简单: 这真的非常easy,不是吗?但还能更简单一些吗? 本站以前介绍过 code snippets.请看这里. Code snippets 在 Xcode 中 ...
- ASSERT_VALID和ASSERT宏分析
这个宏都是MFC的调试宏. ASSERT_VALID宏用来在运行时检查一个对象的内部合法性,比如说现在有一个学生对象,我们知道每个学生的年龄一定大于零,若年龄小于零,则该学生对象肯定有问题. 事实上, ...