js+css实现漂浮空中图片浮动点击放大相册效果代码

代码语言:html

所属分类:图片放大

代码描述:js+css实现漂浮空中图片浮动点击放大相册效果代码

代码标签: js css 漂浮 空中 图片 浮动 点击 放大 相册

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
/* Resetting some basic styles */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

/* Fullscreen container */
body {
	background-color: #1a1919;
	font-family: "Roboto", sans-serif;
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100vh;
	margin: 0;
	overflow: hidden;
	position: relative;
}

/* pop-up */

.popup {
	position: fixed;
	bottom: -100px;
	right: 10px;
	width: 300px;
	height: 170px;
	background-color: #0170b9;
	border-radius: 8px;
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 0;
	transition: bottom 0.5s ease, opacity 0.5s ease;
	z-index: 9999;
}

.popup-content {
	padding: 1rem 0.6rem;
	padding-bottom: 1.5rem;
	text-align: center;
}

.popup-text {
	font-size: 13px;
	font-weight: 400;
	color: #fff;
	letter-spacing: 1px;
	text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.popup.show {
	bottom: 10%;
	opacity: 1;
}

/* end pop-up */

/* Container for the 3D effect */
.container {
	display: flex;
	justify-content: center;
	align-items: center;
	perspective: 1200px;
}

/* 3D card setup */
.tilt-card {
	width: 300px;
	height: 400px;
	position: relative;
	transform-style: preserve-3d;
	transition: transform 0.4s ease-in-out, box-shadow 0.3s ease,
		background-color 0.3s ease;
	cursor: pointer;
	border-radius: 10px;
	box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.tilt-card:hover {
	transform: scale(1.1) rotateX(15deg) rotateY(15deg);
	box-shadow: 0 25px 45px rgba(0, 0, 0, 0.3);
	background-color: transparent;
}

/* Front face of the card */
.tilt-card-front,
.tilt-card-back {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	backface-visibility: hidden;
	display: flex;
	justify-content: center;
	align-items: center;
	border-radius: 10px;
	transition: transform 0.3s ease, background-color 0.3s ease;
	color: #fff;
}

.tilt-card-front {
	background-color: #007bff;
	background-image: url("//repo.bfw.wiki/random/400x400/景色?ran=1");
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	padding: 20px;
	transform: rotateY(0deg);
	transition: transform 0.3s ease;
}

.tilt-card-back {
	background-color: #f1c40f;
	background-image: url("//repo.bfw.wiki/random/400x400/景色?ran=1");
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	padding: 20px;
	transform: rotateY(180deg);
}

.tilt-card:hover .tilt-card-front {
	transform: rotateY(180deg);
}

.tilt-card:hover .tilt-card-back {
	transform: rotateY(360deg);
}

/* Hover effects on text */
h2,
h3 {
	font-size: 24px;
	text-align: center;
	transition: transform 0.3s ease, color 0.3s ease;
	color: #269ceb;
	letter-spacing: 1px;
	text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.9);
	background-color: black;
}

p {
	font-size: 16px;
	text-align: center;
	margin-top: 10px;
	font-weight: 300;
	transition: transform 0.3s ease, color 0.3s ease;
}

/* Hover effects on text */
.tilt-card:hover h2,
.tilt-card:hov.........完整代码请登录后点击上方下载按钮下载查看

网友评论0