最新公告
欢迎您光临零氪源码,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境!欢迎加入VIP

帝国CMS网站用户收到站内消息时弹出提示按钮

正文概述 零氪   2025-05-16  

前言概述

帝国CMS网站用户收到站内消息时弹出提示按钮。A4S零氪源码
A4S零氪源码
==========================================A4S零氪源码

本文实例讲述了帝国CMS网站用户收到站内消息时弹出提示按钮的方法。分享给大家供大家参考。A4S零氪源码
A4S零氪源码
具体实现方法如下:A4S零氪源码

==========================================A4S零氪源码

1、把以下代码加到你的底部模板里“[!--temp.footer--]”

<script>
document.addEventListener('DOMContentLoaded', function() {
    fetch('[!--news.url--]e/member/login/loginjs.php', {
        method: 'GET',
        headers: { 'Content-Type': 'text/html' }
    })
    .then(response => {
        if (!response.ok) throw new Error('Failed to fetch loginjs.php');
        return response.text();
    })
    .then(data => {
        if (data.includes('您有新消息')) {
            const button = document.createElement('a');
            button.href = '[!--news.url--]e/member/msg/';
            button.innerHTML = '<span>New</span>';
            button.title = '您有新消息';
            button.style.cssText = `
                position: fixed;
                top: 60px;
                right: 20px;
                z-index: 1100;
                width: 35px;
                height: 20px;
                background: #ff4d4f;
                color: #fff;
                border-radius: 10px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 11.5px;
                text-decoration: none;
                box-shadow: 0 2px 5px rgba(0,0,0,0.3);
            `;
            const style = document.createElement('style');
            style.textContent = `
                @keyframes shake {
                    0%, 100% { transform: translateY(0); }
                    25% { transform: translateY(-5px); }
                    75% { transform: translateY(5px); }
                }
                .message-button.shake {
                    animation: shake 0.5s ease-in-out infinite;
                }
            `;
            document.head.appendChild(style);
            button.classList.add('message-button', 'shake');
            document.body.appendChild(button);
        }
    })
    .catch(error => {
        console.error('Error fetching loginjs.php:', error);
    });
});
</script>

2、如果“e/member/login/loginjs.php”这个文件你修改过,建议把原始安装包内的文件复制一份改个名字引用到上面这段JS的这一行里:

fetch('[!--news.url--]e/member/login/loginjs.php', {

以上就是帝国CMS网站用户收到站内消息时弹出提示按钮的详细内容,更多请关注『零氪源码』其它相关文章!A4S零氪源码


内容加载中..
点击阅读全文
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

广告
  • 231新增会员(位)
  • 2本年发布(个)
  • 2本月发布(个)
  • 0 今日发布(个)
  • 稳定运行(天)

零氪源码,欢迎你!


零氪源码致力于资源分享!

SVIP会员限时优惠,享受资源免费下载

内容持续更新,永不间断


所有资源均与网上收集整理,仅限交流学习使用

请自觉在下载后24小时内删除

勿用于非法用途,本站不承担任何责任

我知道了

回到顶部