当前位置: 首页 > news >正文

谁看见我的猫照片了

今天分享一个可自由拖得动的图片效果样式。
先看效果:

谁看见我猫的照片了?

再上源码:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Title</title><style>@import url("https://fonts.googleapis.com/css2?family=Caveat");header {position: fixed;display: flex;align-items: center;justify-content: space-between;padding: 0 5%;width: 100%;z-index: 3;height: 7em;font-family: "Bebas Neue", sans-serif;font-size: clamp(0.66rem, 2vw, 1rem);letter-spacing: 0.5em;}a{color: black;text-decoration: none;}.Container {position: absolute;top: 50%;left: 50%;}.Picture {display: inline-block;position: absolute;top: 0;left: 0;border: 5px solid #fff;border-radius: 3px;background: #fff;box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);transform: translate(-50%, -50%);user-select: none;cursor: pointer;}.Picture-img {display: block;width: 300px;height: 300px;pointer-events: none;}.Picture-note {display: flex;align-items: center;justify-content: center;width: 300px;height: 70px;padding: 12px 24px;font-size: 1.5rem;text-align: center;}.Network {display: inline-block;padding: 0 5px;}.Network img {width: 1.5rem;aspect-ratio: 1 / 1;vertical-align: middle;}/* --------------------- *//* Other styles          *//* --------------------- */* {box-sizing: border-box;}body {margin: 0;font-family: 'Caveat', serif;overflow: hidden;}</style>
</head>
<body>
<header><div>Animated Sections</div><div><a href="https://blog.csdn.net/qq_35241329?type=blog">Original By TiMi先生</a></div>
</header>
<div class="Container"><!-- last card --><div class="Picture"><img class="Picture-img" src="https://media.licdn.com/dms/image/C4D03AQHjPuY9oi3Www/profile-displayphoto-shrink_800_800/0/1579768452204?e=2147483647&v=beta&t=4ZgTgOkSEu2eKRoLWEVtgL8s2zYu80YMxI_0018U9Dk" alt="" /><div class="Picture-note"><span>@DeyJordan - <a class="Network" href="https://codepen.io/DeyJordan" target="_top"><img src="https://cdn-icons-png.flaticon.com/512/2111/2111501.png" alt="CodePen" /></a><a class="Network" href="https://twitter.com/DeyJordan" target="_top"><img src="https://www.freepnglogos.com/uploads/twitter-logo-png/twitter-logo-vector-png-clipart-1.png" alt="twitter" /></a></span></div></div><!-- other cards --><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/733/400" alt="" /><div class="Picture-note"><span>Over the clouds</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/613/400" alt="" /><div class="Picture-note"><span>Golden Gate Bridge - San Francisco</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/40/400" alt="" /><div class="Picture-note"><span>Cat nose</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/465/400" alt="" /><div class="Picture-note"><span>Mountain</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/1029/400" alt="" /><div class="Picture-note"><span>Central Park - New York</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/923/400" alt="" /><div class="Picture-note"><span>Autumn</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/425/400" alt="" /><div class="Picture-note"><span>Coffee</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/200/400" alt="" /><div class="Picture-note"><span>An Irish cow enjoying the wind on the beach</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/244/400" alt="" /><div class="Picture-note"><span>pelicans at the water's edge</span></div></div><div class="Picture"><img class="Picture-img" src="https://picsum.photos/id/15/400" alt="" /><div class="Picture-note"><span>Waterfall</span></div></div>
</div>
</body>
<script>const pictures = document.querySelectorAll('.Picture');var previousTouch = undefined;function updateElementPosition(element, event) {var movementX, movementY;if (event.type === 'touchmove') {const touch = event.touches[0];movementX = previousTouch ? touch.clientX - previousTouch.clientX : 0;movementY = previousTouch ? touch.clientY - previousTouch.clientY : 0;console.log('touch', { movementX: movementX, newX: touch.clientX, oldX: previousTouch && previousTouch.clientX });previousTouch = touch;} else {movementX = event.movementX;movementY = event.movementY;}const elementY = parseInt(element.style.top || 0) + movementY;const elementX = parseInt(element.style.left|| 0) + movementX;element.style.top = elementY + "px";element.style.left = elementX + "px";}function startDrag(element, event) {const updateFunction = (event) => updateElementPosition(element, event);const stopFunction = () => stopDrag({update: updateFunction, stop: stopFunction});document.addEventListener("mousemove", updateFunction);document.addEventListener("touchmove", updateFunction);document.addEventListener("mouseup", stopFunction);document.addEventListener("touchend", stopFunction);}function stopDrag(functions) {previousTouch = undefined;document.removeEventListener("mousemove", functions.update);document.removeEventListener("touchmove", functions.update);document.removeEventListener("mouseup", functions.stop);document.removeEventListener("touchend", functions.stop);}pictures.forEach(picture => {const range = 100;const randomX = Math.random() * (range * 2) - range;const randomY = Math.random() * (range * 2) - range;const randomRotate = Math.random() * (range / 2) - range / 4;const startFunction = (event) => startDrag(picture, event);picture.style.top = `${randomY}px`;picture.style.left = `${randomX}px`;picture.style.transform = `translate(-50%, -50%) rotate(${randomRotate}deg)`;picture.addEventListener("mousedown", startFunction);picture.addEventListener("touchstart", startFunction);});
</script>
</html>

相关文章:

谁看见我的猫照片了

今天分享一个可自由拖得动的图片效果样式。 先看效果&#xff1a; 谁看见我猫的照片了&#xff1f; 再上源码&#xff1a; <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>Title</title><st…...

数据结构与算法之深度优先算法详解

深度优先算法&#xff08;Depth First Search&#xff0c;DFS&#xff09;是一种常见的图形算法&#xff0c;它是一种用于遍历或搜索树或图的算法。在深度优先搜索中&#xff0c;我们首先探索一个子树的深度&#xff0c;然后再回溯到父节点&#xff0c;接着探索另一个子树的深度…...

C# 给winfrom窗体添加皮肤控件

如何快速给C# winform添加好看的皮肤C# Winform中窗体的美化 SkinEngine的应用 皮肤控件换肤素材包&#xff0c;IrisSkin2.dll皮肤素材资源下载 压缩包内一共有22种皮肤素材&#xff0c;使用说明&#xff1a;把控件拖到你的form上&#xff0c;只需一行代码&#xff0c;即可实…...

数据分析真的很火吗?真的有很多企业需要这样的岗位吗?求大佬指点。

“我是去年毕业的&#xff0c;因为疫情影响&#xff0c;整个就业环境都很不好&#xff0c;很多企业都裁员了。加上疫情三年基本都是玩过去&#xff0c;也没啥一技之长&#xff0c;就业就更难了。听说现在做数据分析的人很多&#xff0c;我身边的朋友都在转行做数据分析。 其实…...

100 个 Go 错误以及如何避免:9~12

协议&#xff1a;CC BY-NC-SA 4.0 译者&#xff1a;飞龙 本文来自【OpenDocCN 饱和式翻译计划】&#xff0c;采用译后编辑&#xff08;MTPE&#xff09;流程来尽可能提升效率。 真相一旦入眼&#xff0c;你就再也无法视而不见。——《黑客帝国》 九、并发实践 本章涵盖 防止 …...

用户/用户组管理

用户管理 * useradd 命令添加用户&#xff0c;会在/etc/passwd生成用户信息&#xff0c;信息分为7列&#xff0c;被6个冒号隔开 第一列 username (login name) 第二列 密码&#xff0c;但是该列已经被移除&#xff0c;用x表示&#xff0c;密码信息已经存放在了/etc/shadow文…...

如何进行TCP抓包调试?

网络调试工具——Wireshark Wireshark 是世界上应用最广泛的网络协议分析器&#xff0c;它让我们在微观层面上看到整个网络正在发生的事情。 Wireshark 本身是一个开源项目&#xff0c;所以也得到了很多志愿者的支持。同时&#xff0c;Wireshark 具有丰富的功能集&#xff0c;…...

分享一个国内可用的ChatGPT网站,免费无限制,支持AI绘画 - AI 百晓生

背景 ChatGPT作为一种基于人工智能技术的自然语言处理工具&#xff0c;近期的热度直接沸腾&#x1f30b;。 作为一个AI爱好者&#xff0c;翻遍了各大基于ChatGPT的网站&#xff0c;终于找到一个免费&#xff01;免登陆&#xff01;手机电脑通用&#xff01;国内可直接对话的C…...

API安全性的要素与开发人员必修课测试

一、API安全性的要素主要包括以下几点&#xff1a; 1.身份验证和访问控制&#xff1a;API应该通过身份验证来验证请求的源&#xff0c;确保只有授权的用户或应用程序才能访问API。这可以通过使用API密钥、访问令牌、OAuth令牌或其他身份验证机制实现。 2.数据加密&#xff1a;A…...

leetcode 651. 4键键盘

651. 4键键盘 中等 102 company 微软 Microsoft company 谷歌 Google company 亚马逊 假设你有一个特殊的键盘包含下面的按键&#xff1a; A&#xff1a;在屏幕上打印一个 ‘A’。Ctrl-A&#xff1a;选中整个屏幕。Ctrl-C&#xff1a;复制选中区域到缓冲区。Ctrl-V&#xff1a…...

Python垃圾回收机制

Python 运行过程中会不停的创建各种变量&#xff0c;而这些变量是需要存储在内存中的&#xff0c;随着程序的不断运行&#xff0c;变量数量越来越多&#xff0c;所占用的空间势必越来越大&#xff0c;如果对变量所占用的内存空间管理不当的话&#xff0c;那么肯定会出现 out of…...

Grafana插件安装并接入zabbix数据源(03)

一、在线安装插件 如果不指定插件安装位置,则默认安装位置为/var/lib/grafana/plugins;插件安装后需要重启grafana-server 安装zabbix插件alexanderzobnin-zabbix-app # grafana-cli plugins install alexanderzobnin-zabbix-app 使用--pluginsDir指定安装路径 # grafana…...

简述 JavaScript 中 prototype

简述 JavaScript 中 prototype 这篇笔记主要捋一下这么几个概念&#xff1a; JS 的继承构造函数new 的作用及简易实现__proto__ & prototype同样的方法&#xff0c;class 和 prototype 中分别是怎么实现的 基础概念 JS 是通过 prototype chaining 实现继承的语言&#…...

一觉醒来Chat gpt就被淘汰了

目录 什么是Auto GPT&#xff1f; 与其他语言生成模型相比&#xff0c;Auto GPT具有以下优点 Auto GPT的能力 Auto GPT的能力非常强大&#xff0c;它可以应用于各种文本生成场景&#xff0c;包括但不限于以下几个方面 Auto GPT的历史 马斯克说&#xff1a;“ChatGPT 好得吓…...

13款JavaScript图像处理库,建议收藏备用

pica&#xff1a; 一个在浏览器中调整图像大小&#xff0c;而不会出现像素失真&#xff0c;处理速度非常快的图片处理库&#xff0c;仓库地址https://github.com/nodeca/picahtml2canvas&#xff1a; 强大的使用js开发的浏览器网页截图工具&#xff0c;仓库地址https://github.…...

uniapp m3u8格式视频加载

uniapp一&#xff1a;mui-player&#xff1a;三方 h5 web app uniapp 使用 mui-player 插件播放 m3u8/flv 视频流_翘翘红的博客-CSDN博客 uniapp 开发的h5项目&#xff0c;需要播放m3u8/flv后缀的视频&#xff0c;网上有很多视频插件&#xff0c;但是样式和效果不尽如人意&am…...

iOS描述文件(.mobileprovision)一键申请

iOS描述文件(.mobileprovision)一键申请 在主界面上点击描述文件按钮。 新建ios描述文件 然后点击新建&#xff0c;然后输入描述文件名称&#xff0c;描述文件名称字符和数字&#xff0c;自己好辨识就可以。然后选择描述文件类型&#xff0c;再选择bundle ID&#xff0c;如果…...

进行性能压力测试的原因、目的和好处

性能压力测试是指在模拟高负载、高并发情况下对软件系统进行测试&#xff0c;以衡量系统在实际使用过程中的性能表现。这些测试可以为生产环境中的应用程序提供关键数据&#xff0c;并帮助开发人员从根本上了解系统的实际性能。在本文中&#xff0c;我们将探讨进行性能压力测试…...

【计算机视觉】如何利用 CLIP 做简单的人脸任务?(含源代码)

文章目录 一、数据集介绍二、源代码 结果三、代码逐行解读 一、数据集介绍 CELEBA 数据集&#xff08;CelebFaces Attributes Dataset&#xff09;是一个大规模的人脸图像数据集&#xff0c;旨在用于训练和评估人脸相关的计算机视觉模型。该数据集由众多名人的脸部图像组成&a…...

基于显扬科技3D视觉相机的医疗试管分拣系统

行业现状&#xff1a; 医疗试管分拣是医疗行业中的一个重要环节&#xff0c;指将医疗实验室或生物技术研究中的试管按照一定的规则进行分拣&#xff0c;并对试管的类型、位置、数量等信息进行识别和管理。 随着医疗技术的不断发展和诊断治疗的精细化&#xff0c;医疗试管分拣…...

Java 语言特性(面试系列1)

一、面向对象编程 1. 封装&#xff08;Encapsulation&#xff09; 定义&#xff1a;将数据&#xff08;属性&#xff09;和操作数据的方法绑定在一起&#xff0c;通过访问控制符&#xff08;private、protected、public&#xff09;隐藏内部实现细节。示例&#xff1a; public …...

在Ubuntu中设置开机自动运行(sudo)指令的指南

在Ubuntu系统中&#xff0c;有时需要在系统启动时自动执行某些命令&#xff0c;特别是需要 sudo权限的指令。为了实现这一功能&#xff0c;可以使用多种方法&#xff0c;包括编写Systemd服务、配置 rc.local文件或使用 cron任务计划。本文将详细介绍这些方法&#xff0c;并提供…...

高危文件识别的常用算法:原理、应用与企业场景

高危文件识别的常用算法&#xff1a;原理、应用与企业场景 高危文件识别旨在检测可能导致安全威胁的文件&#xff0c;如包含恶意代码、敏感数据或欺诈内容的文档&#xff0c;在企业协同办公环境中&#xff08;如Teams、Google Workspace&#xff09;尤为重要。结合大模型技术&…...

【数据分析】R版IntelliGenes用于生物标志物发现的可解释机器学习

禁止商业或二改转载&#xff0c;仅供自学使用&#xff0c;侵权必究&#xff0c;如需截取部分内容请后台联系作者! 文章目录 介绍流程步骤1. 输入数据2. 特征选择3. 模型训练4. I-Genes 评分计算5. 输出结果 IntelliGenesR 安装包1. 特征选择2. 模型训练和评估3. I-Genes 评分计…...

python爬虫——气象数据爬取

一、导入库与全局配置 python 运行 import json import datetime import time import requests from sqlalchemy import create_engine import csv import pandas as pd作用&#xff1a; 引入数据解析、网络请求、时间处理、数据库操作等所需库。requests&#xff1a;发送 …...

阿里云Ubuntu 22.04 64位搭建Flask流程(亲测)

cd /home 进入home盘 安装虚拟环境&#xff1a; 1、安装virtualenv pip install virtualenv 2.创建新的虚拟环境&#xff1a; virtualenv myenv 3、激活虚拟环境&#xff08;激活环境可以在当前环境下安装包&#xff09; source myenv/bin/activate 此时&#xff0c;终端…...

实战设计模式之模板方法模式

概述 模板方法模式定义了一个操作中的算法骨架&#xff0c;并将某些步骤延迟到子类中实现。模板方法使得子类可以在不改变算法结构的前提下&#xff0c;重新定义算法中的某些步骤。简单来说&#xff0c;就是在一个方法中定义了要执行的步骤顺序或算法框架&#xff0c;但允许子类…...

第八部分:阶段项目 6:构建 React 前端应用

现在&#xff0c;是时候将你学到的 React 基础知识付诸实践&#xff0c;构建一个简单的前端应用来模拟与后端 API 的交互了。在这个阶段&#xff0c;你可以先使用模拟数据&#xff0c;或者如果你的后端 API&#xff08;阶段项目 5&#xff09;已经搭建好&#xff0c;可以直接连…...

【记录坑点问题】IDEA运行:maven-resources-production:XX: OOM: Java heap space

问题&#xff1a;IDEA出现maven-resources-production:operation-service: java.lang.OutOfMemoryError: Java heap space 解决方案&#xff1a;将编译的堆内存增加一点 位置&#xff1a;设置setting-》构建菜单build-》编译器Complier...

【Qt】控件 QWidget

控件 QWidget 一. 控件概述二. QWidget 的核心属性可用状态&#xff1a;enabled几何&#xff1a;geometrywindows frame 窗口框架的影响 窗口标题&#xff1a;windowTitle窗口图标&#xff1a;windowIconqrc 机制 窗口不透明度&#xff1a;windowOpacity光标&#xff1a;cursor…...