当前位置: 首页 > 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;医疗试管分拣…...

【位运算】消失的两个数字(hard)

消失的两个数字&#xff08;hard&#xff09; 题⽬描述&#xff1a;解法&#xff08;位运算&#xff09;&#xff1a;Java 算法代码&#xff1a;更简便代码 题⽬链接&#xff1a;⾯试题 17.19. 消失的两个数字 题⽬描述&#xff1a; 给定⼀个数组&#xff0c;包含从 1 到 N 所有…...

《Playwright:微软的自动化测试工具详解》

Playwright 简介:声明内容来自网络&#xff0c;将内容拼接整理出来的文档 Playwright 是微软开发的自动化测试工具&#xff0c;支持 Chrome、Firefox、Safari 等主流浏览器&#xff0c;提供多语言 API&#xff08;Python、JavaScript、Java、.NET&#xff09;。它的特点包括&a…...

srs linux

下载编译运行 git clone https:///ossrs/srs.git ./configure --h265on make 编译完成后即可启动SRS # 启动 ./objs/srs -c conf/srs.conf # 查看日志 tail -n 30 -f ./objs/srs.log 开放端口 默认RTMP接收推流端口是1935&#xff0c;SRS管理页面端口是8080&#xff0c;可…...

【android bluetooth 框架分析 04】【bt-framework 层详解 1】【BluetoothProperties介绍】

1. BluetoothProperties介绍 libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop BluetoothProperties.sysprop 是 Android AOSP 中的一种 系统属性定义文件&#xff08;System Property Definition File&#xff09;&#xff0c;用于声明和管理 Bluetooth 模块相…...

(转)什么是DockerCompose?它有什么作用?

一、什么是DockerCompose? DockerCompose可以基于Compose文件帮我们快速的部署分布式应用&#xff0c;而无需手动一个个创建和运行容器。 Compose文件是一个文本文件&#xff0c;通过指令定义集群中的每个容器如何运行。 DockerCompose就是把DockerFile转换成指令去运行。 …...

Web 架构之 CDN 加速原理与落地实践

文章目录 一、思维导图二、正文内容&#xff08;一&#xff09;CDN 基础概念1. 定义2. 组成部分 &#xff08;二&#xff09;CDN 加速原理1. 请求路由2. 内容缓存3. 内容更新 &#xff08;三&#xff09;CDN 落地实践1. 选择 CDN 服务商2. 配置 CDN3. 集成到 Web 架构 &#xf…...

LeetCode - 199. 二叉树的右视图

题目 199. 二叉树的右视图 - 力扣&#xff08;LeetCode&#xff09; 思路 右视图是指从树的右侧看&#xff0c;对于每一层&#xff0c;只能看到该层最右边的节点。实现思路是&#xff1a; 使用深度优先搜索(DFS)按照"根-右-左"的顺序遍历树记录每个节点的深度对于…...

Windows电脑能装鸿蒙吗_Windows电脑体验鸿蒙电脑操作系统教程

鸿蒙电脑版操作系统来了&#xff0c;很多小伙伴想体验鸿蒙电脑版操作系统&#xff0c;可惜&#xff0c;鸿蒙系统并不支持你正在使用的传统的电脑来安装。不过可以通过可以使用华为官方提供的虚拟机&#xff0c;来体验大家心心念念的鸿蒙系统啦&#xff01;注意&#xff1a;虚拟…...

Linux-进程间的通信

1、IPC&#xff1a; Inter Process Communication&#xff08;进程间通信&#xff09;&#xff1a; 由于每个进程在操作系统中有独立的地址空间&#xff0c;它们不能像线程那样直接访问彼此的内存&#xff0c;所以必须通过某种方式进行通信。 常见的 IPC 方式包括&#…...

python基础语法Ⅰ

python基础语法Ⅰ 常量和表达式变量是什么变量的语法1.定义变量使用变量 变量的类型1.整数2.浮点数(小数)3.字符串4.布尔5.其他 动态类型特征注释注释是什么注释的语法1.行注释2.文档字符串 注释的规范 常量和表达式 我们可以把python当作一个计算器&#xff0c;来进行一些算术…...