返回列表 发布新帖
查看: 177|回复: 0

[代码技巧] 子比主题 – JS弹窗引导提醒样式

[复制链接]
SunJu_FaceMall
社区贡献

319

主题

192

回帖

1万

积分

等级头衔
Icon组别 : 管理员
Icon等级 :

积分成就
   钻石 : 1 颗
   贡献 : 34505 点
   金币 : 92 枚
Icon在线时间 : 1445 小时
Icon注册时间 : 2024-11-22
Icon最后登录 : 2026-5-13

荣誉勋章

会员LV.1会员LV.2会员LV.3会员LV.4会员LV.5会员LV.6会员LV.7会员LV.8会员LV.9会员LV.10

实力殿堂·绝代收藏家

飞流名人堂成员 1 wu 实名认证 特邀大神认证 诚信商家认证 信誉担保认证 精华作者+认证 飞流官方团队 vip vip-year 发表于 2025-10-6 22:30:42 | 查看全部 |阅读模式 浙江金华

交易无需等待,成交就是现在,全面资源整合网络大咖云集,让你轻松玩转互联网!

您需要 登录 才可以下载或查看,没有账号?立即注册

×
给子比顶部加一个弹窗跳转,自带win和mac判断系统,很多站有的在使用这个弹窗,一个简约好看的弹窗,如果喜欢的话可以放到子比里面即可

tengfei_down (14).webp


代码部署
  1.     // 判断存在jq资源
  2.     try {
  3.         if($ || jQuery) {
  4.           tipsFun();
  5.         }
  6.       } catch(e) {
  7.         let script=document.createElement("script");
  8.         script.type="text/javascript";
  9.         script.src="https://cdn.mac89.com/common/static/jquery.min.js";
  10.       
  11.         document.getElementsByTagName('head')[0].appendChild(script);
  12.       
  13.         script.onload = tipsFun;
  14.       }
  15.       
  16.       
  17.       function tipsFun() {
  18.         // 判断用户是否是windows
  19.         if((navigator.platform == "Win32") || (navigator.platform == "Windows")) {
  20.           // let hostName = location.hostname;
  21.           // if(hostName === 'mac.mac89.com') return;
  22.       
  23.           let curTime = new Date().getTime();
  24.           if(!window.localStorage.hasTips || ((curTime - window.localStorage.hasTips) >= 86400000)) {
  25.             setTimeout(()=> {
  26.               $(document).ready(function(){
  27.                 let tipHtml = `
  28.                   <div class="tip-box" id="tip-box" style="position: fixed; z-index: 9999; width: 740px; height: 150px; background-color: #fff; border-radius: 0 0 20px 20px; text-align: center; font-size: 16px; top: 0; left: 50%; margin-left: -370px; box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.2); display: none; transform: translateY(-100%); transition: all .6s;">
  29.                     <p class="tip" style="font-size: 18px; line-height: 1; margin: 38px 0 22px;">欢迎来到腾飞博客,如果需要更多子比美化点击前往</p>
  30.                     <button class="nomore" style="width: 120px; cursor: pointer; height: 40px; border: 1px solid #ddd; outline: none; border-radius: 5px; margin-right: 40px;">不再提醒</button>
  31.                     <button class="cancel" style="background-color: #333; color: #fff; width: 120px; cursor: pointer; height: 40px; border: none; outline: none; border-radius: 5px; margin-right: 40px;">继续浏览</button>
  32.                     <button class="sure" style="height: 40px; padding: 0 30px; background-color: #1B78F5; cursor: pointer; color: #fff; border-radius: 5px; outline: none; border: none;">立即前往 (10秒)</button>
  33.                   </div>`;
  34.       
  35.                 $('body').append(tipHtml);
  36.       
  37.                 const $tipBox = $('#tip-box');
  38.                 $tipBox.show().css('transform', 'translateY(0)');
  39.       
  40.                 $tipBox.on('click', '.cancel', ()=> {
  41.                   removeTip();
  42.                 }).on('click', '.sure', ()=> {
  43.                   window.open("https://www.tfbkw.com/tag/%e5%ad%90%e6%af%94%e4%b8%bb%e9%a2%98");
  44.                 }).on('click', '.nomore', ()=> {
  45.                   removeTip();
  46.                   window.localStorage.hasTips = curTime;
  47.                 })
  48.       
  49.                 let time = 10, timer;
  50.       
  51.                 timer = setInterval(()=> {
  52.                   time--;
  53.                   $tipBox.find('.sure').text('立即前往 ('+ time +'秒)')
  54.                   if(time < 1) {
  55.                     removeTip();
  56.                   }
  57.                 }, 1000)
  58.       
  59.                 function removeTip() {
  60.                   $tipBox.css('transform', 'translateY(-100%)');
  61.                   clearInterval(timer);
  62.                   setTimeout(function() {
  63.                     $tipBox.remove();
  64.                   }, 600)
  65.                 }
  66.               });
  67.             }, 1000);
  68.           }
  69.         }
  70.          $('#shop-box').on('click', '.close', function() {
  71.           let $box = $('#shop-box')
  72.            if($box.hasClass('bot')) {
  73.              $box.css({'bottom': '0'})
  74.              $(this).css({'transform': 'rotate(0)'})
  75.              window.localStorage.hideShop = '';
  76.            } else {
  77.             $box.css({'bottom': '-117px'})
  78.             $(this).css({'transform': 'rotate(180deg)'})
  79.             window.localStorage.hideShop = 'hide';
  80.            }
  81.       
  82.            $box.toggleClass('bot');
  83.          })
  84.       }
复制代码
2025-10-6 22:30 上传
文件大小:
87.4 KB
下载次数:
1
最好是下载这个本地化的JS
严禁发布违规违法的信息内容链接,违者经审查后予以警告或封号处理!


【小飞侠提醒您:搜索时输入t1476代号,方便好记直达本帖!】

本帖被以下淘专辑推荐:

路虽远,行则将至;事虽难,做则必成。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

飞流广播+ 发布

系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
10-30 17:02
系统消息:柒沐已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
10-09 09:07
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
09-24 09:00
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
09-11 11:40
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
09-02 09:17
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
08-27 08:56
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
08-20 15:12
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
08-03 10:22
系统消息:柒沐已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
06-30 08:57
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
06-18 09:14
系统消息:清风网络已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
04-11 09:40
系统消息:清风网络已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-10 09:31
系统消息:IXM77777已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-09 13:44
系统消息:清风网络已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-09 09:22
系统消息:柒沐已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
04-09 08:52
系统消息:清风网络已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-08 09:24
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-07 09:02
系统消息:柒沐已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
02-27 09:35
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
02-26 09:06
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
02-25 08:49
站内通告

提供资源交易、信息共享、靓号交流、技术变现、学习问答、兴趣娱乐等全面服务。

1.丰富功能系统,扩展社区特色玩法,打造最好的互联网聚集圈子。

2.准确信息真实交易,安全快捷又方便,让虚拟交易面对面。

3. 天上不会掉馅饼,话术骗术迷人心,切勿脱离平台线下交易,被骗与平台无关!

4. 欺诈骗钱,违规违法将视情受到警告&禁言&封号甚至检举至👮🏻‍♀️处理!

官方Q群:钉推群:BAYR2383 站长QQ:3388700000

飞流论坛(FLLT.CN),一个专注于资源信息发布、虚拟网络交易、技术学习与娱乐社交的交流平台。
  • 钉钉新帖推送群
  • 官方交流QQ群
  • 站长唯一微信号

💥客户端|🧿小黑屋|📴手机页|飞流网 |网站地图

GMT+8, 2026-5-13 12:13 , Processed in 0.075844 second(s), 68 queries, MemCached On , Gzip On.

飞流论坛 HanAnalytics icp

Copyright © 2024-2026 飞流网 版权所有 All Rights Reserved. X3.5

快速回复 返回顶部 返回列表