惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
V
V2EX
IT之家
IT之家
J
Java Code Geeks
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
D
Docker
S
Secure Thoughts
Recent Announcements
Recent Announcements
Webroot Blog
Webroot Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
博客园_首页
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Security Archives - TechRepublic
Security Archives - TechRepublic
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
I
InfoQ
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
T
Troy Hunt's Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
美团技术团队
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Scott Helme
Scott Helme
T
Tor Project blog
Know Your Adversary
Know Your Adversary
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
G
Google Developers Blog

博客园 - 陈大欠

andrej karpathy skills 从 Harness Engineering 到 superpowers 从 Harness Engineering 到 OpenSpec 从 Harness Engineering 到 Trellis Harness Engineering copilot-api:让 ClaudeCode 接入 Github Copilot Claude Code Hooks 配置说明 Scoop Claude-LED MagicCenterHub Windows Terminal & PowerShell 玩转 Visual Studio 外部工具 WCF API 语义搜索工具 Step Builder:让对象构建有顺序、有边界、有校验 基于 Attribute 的 AOP 字段校验 浅析 .NET 响应式编程 IObservable与ReactiveX Cron表达式简明教程 正则表达式拾遗 快速批量升级 NugetPackage 版本 C# IEquatable和IEqualityComparer 最佳实践 使用XDT提高开发效率 如何保证XML正确性 分析 Dump 入门简明教程 Git commit emoji 对照表 ELK Stack 笔记 HTML5/CSS3(PrefixFree.js) 3D文字特效 Jquery实现图片上下一张 使用jquery构建Metro style 返回顶部 使用js实现移动设备访问跳转到指定目录 从一幅图中了解开源世界 Jquery ajax 学习笔记 工欲善其事必先利其器系列之:在VS里面折叠js代码
js css 构建滚动边框
陈大欠 · 2014-04-11 · via 博客园 - 陈大欠

注:预览效果请点击result选项卡,个人认为这种效果非常适合做友情链接.

完整代码

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>边框虚线旋转</title>
    <style type="text/css" charset="utf-8">
        .coop-list {
            position: relative;
            width: 60%;
            overflow: hidden;
            margin: 20px;
        }

        .topBorder-move {
            position: relative;
            left: -1500px;
            width: 3000px;
            border-top: 2px dashed #DADDE1;
        }

        .bottomBorder-move {
            position: relative;
            left: -1500px;
            width: 4000px;
            border-bottom: 2px dashed #DADDE1;
        }

        .leftBorder-move {
            position: absolute;
            top: -1500px;
            width: 1px;
            height: 4000px;
            border-left: 2px dashed #DADDE1;
        }

        .rightBorder-move {
            position: absolute;
            right: 0;
            top: -1500px;
            width: 1px;
            height: 3000px;
            border-right: 2px dashed #DADDE1;
        }
    </style>
</head>

<body>
    <div class="coop-list">
        <div class="topBorder-move" id="J_borTop"></div>
        <div class="leftBorder-move" id="J_borLeft"></div>
        <div> 转啊转啊转啊转</div>
        <div class="rightBorder-move" id="J_borRight"></div>
        <div class="bottomBorder-move" id="J_borBottom"></div>
    </div>

    <script>
        var getStyleValue = function (ele, attr) {
            var doc = document;
            var style = ele.currentStyle || doc.defaultView.getComputedStyle(ele, null);
            return parseInt(style[attr].replace(/px/g, ""));
        };

        var $G = function (id) {
            return document.getElementById(id);
        };

        (function () {
            var borTop = $G("J_borTop"),
                 borBottom = $G("J_borBottom"),
                 borLeft = $G("J_borLeft"),
                 borRight = $G("J_borRight"),
                 left = getStyleValue(borTop, 'left'),
                 top = getStyleValue(borLeft, 'top');

            setInterval(function () {
                if (left < 0) {
                    left += 2;
                    borRight.style.top = left + "px";
                    borTop.style.left = left + "px";
                } else {
                    left = -1500
                };

                if (top > -3000) {
                    top -= 2;
                    borBottom.style.left = top + "px";
                    borLeft.style.top = top + "px";
                } else {
                    top = -1500
                };
            }, 60);
        })();
    </script>
</body>
</html>