V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
pzistart
V2EX  ›  程序员

大佬们, html 代码怎么让任务栏浏览器做窗口抖动,类似于微信收到消息那种任务栏抖动提示

  •  
  •   pzistart · 285 天前 · 1479 次点击
    这是一个创建于 285 天前的主题,其中的信息可能已经有所发展或是发生改变。

    大佬们,html 代码怎么让浏览器做窗口抖动,类似于微信收到消息那种任务栏抖动提示

    7 条回复    2023-07-18 21:12:56 +08:00
    chongdianbao
        1
    chongdianbao  
       285 天前
    建议做个浏览器
    pzistart
        2
    pzistart  
    OP
       285 天前
    @chongdianbao 你是真秀 陈泽秀都没你秀
    coolfan
        3
    coolfan  
       285 天前
    让浏览器发通知,像别的桌面程序一样可以从右下角弹窗消息,同时任务栏也会高亮吧
    w292614191
        4
    w292614191  
       285 天前
    document.title='您有的新的消息,[xxx 未完成,请及时审核!]',文字长一些,然后就会滚动效果了,看起来不错。

    还有一种是:
    document.title=''
    sleep(1s)
    document.title='消息'
    做个定时器会有闪动效果,用户感知会更强。
    7gugu
        5
    7gugu  
       285 天前   ❤️ 2
    原生浏览器做不了的,Web Notifications 才是正解,用这个可以帮你提醒用户
    netnr
        6
    netnr  
       285 天前
    xgfan
        7
    xgfan  
       284 天前
    窗口抖不了,但是整个 body 抖一抖还是没问题的。

    setInterval(function(){
    var offsetX = Math.random() * 10 - 5;
    var offsetY = Math.random() * 10 - 5;
    document.querySelector('body').style.transform = 'translate(' + offsetX + 'px, ' + offsetY + 'px)';
    setTimeout(function() {
    document.querySelector('body').style.transform = 'translate(0, 0)';
    }, 50);
    },500)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5354 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 07:10 · PVG 15:10 · LAX 00:10 · JFK 03:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.