码迷,mamicode.com
首页 > Web开发 > 详细

jQuery和CSS的拍摄效果

时间:2019-06-25 13:29:20      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:size   relative   spl   char   sans   play   har   www   container   


<!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>jQuery和CSS的拍摄效果</title>
<style>
body,h1,h2,h3,p,quote,small,form,input,ul,li,ol,label{margin:0;padding:0}body{color:#fcfcfc;font-size:.825em;background-color:#011d2e;font-family:Arial,Helvetica,sans-serif}#main{margin:0 auto;width:960px;height:600px}.shot{border:3px solid #fcfcfc;float:right;position:relative;margin-left:10px;overflow:hidden;-moz-box-shadow:0 0 2px #000;-webkit-box-shadow:0 0 2px #000;box-shadow:0 0 2px #000}.shot img{display:block}.album{bottom:50px;height:110px;overflow:hidden;position:absolute;right:20px;width:490px}.album .slide{width:700px;height:110px;position:relative;left:-210px}
.container{overflow:hidden;cursor:url(http://www.jq22.com/demo/photo/photoShoot/blank.cur),default;position:relative}.container.googleChrome{cursor:url(http://www.jq22.com/demo/photo/photoShoot/blank_google_chrome.cur),default}.overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:#000}.viewFinder{position:absolute;top:0;left:0}.blur{position:absolute;top:0;left:0}
    </style>
</head>
<body>

<div id="main"></div>

<script src="https://lib.baomitu.com/jquery/1.4.2/jquery.min.js"></script>
<script src="http://www.jq22.com/demo/photo/photoShoot/jquery.photoShoot-1.0.js"></script>
<script>
$(document).ready(function() {
var main = $(‘#main‘);
main.width(Math.min(1024, $(document).width()));
var pics = new Array({
url: ‘/images/index/t.jpg‘,
size: {
x: 1024,
y: 768
}
},
{
url: ‘/images/index/t.jpg‘,
size: {
x: 1024,
y: 768
}
},
{
url: ‘/images/index/t.jpg‘,
size: {
x: 1024,
y: 768
}
},
{
url: ‘/images/index/t.jpg‘,
size: {
x: 1158,
y: 756
}
});
var bg = pics[parseInt(Math.random() * 4)];
var opts = {
image: bg.url,
onClick: shoot,
opacity: 0.8,
blurLevel: 4
}
main.photoShoot(opts);
$(‘<div class="album">‘).html(‘<div class="slide" />‘).appendTo(main);
function shoot(position) {
main.find(‘.overlay‘).css(‘background-color‘, ‘white‘);
setTimeout(function() {
main.find(‘.overlay‘).css(‘background-color‘, ‘‘)
},
100);
var newShot = $(‘<div class="shot">‘).width(150).height(100);
newShot.append($(‘<img src="‘ + bg.url + ‘" width="‘ + (bg.size.x / 2) + ‘" height="‘ + (bg.size.y / 2) + ‘" />‘).css(‘margin‘, -position.top * 0.5 + ‘px 0 0 -‘ + position.left * 0.5 + ‘px‘));
$(‘.shot‘).eq(3).remove();
newShot.css(‘margin-right‘, -160).prependTo(‘.album .slide‘).animate({
marginRight: 0
},
‘slow‘);
}
});
</script>
</body>
</html>

jQuery和CSS的拍摄效果

标签:size   relative   spl   char   sans   play   har   www   container   

原文地址:https://www.cnblogs.com/xieyongbin/p/11082072.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!