feat: 添加瞬间页面模拟器功能

- 在 PC 端点击瞬间链接时,弹出模拟 iPhone 16 的窗口展示内容- 添加相应的 HTML、CSS 和 JavaScript 代码实现该功能
-优化了用户体验,特别是在大屏幕上查看瞬间内容时
This commit is contained in:
hehh
2025-07-16 15:06:18 +08:00
parent c0aad01d0b
commit 329e731f32
3 changed files with 114 additions and 3 deletions

View File

@@ -88,3 +88,38 @@ $('.btn-mobile-menu__icon').click(function () {
}
$('.btn-mobile-menu__icon').toggleClass('social iconfont icon-list social iconfont icon-ngleup animated fadeIn');
});
// 处理瞬间链接点击事件
$('.moments-link').on('click', function (e) {
e.preventDefault(); // 阻止默认跳转
// 获取链接地址
var url = $(this).attr('href');
// 判断是否是移动端
var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
if (isMobile) {
// 移动端:直接跳转
window.location.href = url;
} else {
// PC端在模拟器中显示
$('#moment-frame').attr('src', url);
$('.iphone-simulator').show();
$('.overlay').show();
}
});
// 关闭按钮点击事件
$('.close-btn').on('click', function () {
$('.iphone-simulator').hide();
$('.overlay').hide();
$('#moment-frame').attr('src', ''); // 清空iframe内容
});
// 遮罩层点击事件
$('.overlay').on('click', function () {
$(this).hide();
$('.iphone-simulator').hide();
$('#moment-frame').attr('src', '');
});