迁移前台基础页面脚本
This commit is contained in:
@@ -410,12 +410,12 @@
|
||||
@csrf
|
||||
<input type="hidden" name="vip_level_id" value="{{ $vip->id }}">
|
||||
<button type="submit" name="provider" value="alipay"
|
||||
onclick="return confirm('确认使用支付宝支付 {{ $vip->price }} 元购买【{{ $vip->name }}】吗?');"
|
||||
data-front-submit-confirm="确认使用支付宝支付 {{ $vip->price }} 元购买【{{ $vip->name }}】吗?"
|
||||
class="px-3 py-1.5 rounded-lg bg-indigo-600 text-white text-xs font-bold hover:bg-indigo-700 transition">
|
||||
支付宝
|
||||
</button>
|
||||
<button type="submit" name="provider" value="wechat"
|
||||
onclick="return confirm('确认使用微信支付 {{ $vip->price }} 元购买【{{ $vip->name }}】吗?');"
|
||||
data-front-submit-confirm="确认使用微信支付 {{ $vip->price }} 元购买【{{ $vip->name }}】吗?"
|
||||
class="px-3 py-1.5 rounded-lg bg-emerald-600 text-white text-xs font-bold hover:bg-emerald-700 transition">
|
||||
微信
|
||||
</button>
|
||||
@@ -551,48 +551,3 @@
|
||||
</main>
|
||||
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 滚动时高亮右侧导航当前所在板块
|
||||
*/
|
||||
(function() {
|
||||
// 屏幕宽度 >= 1024px 时显示右侧导航
|
||||
const aside = document.getElementById('guide-aside');
|
||||
const nav = document.getElementById('guide-nav');
|
||||
if (!aside || !nav) return;
|
||||
|
||||
function checkWidth() {
|
||||
aside.style.display = window.innerWidth >= 1024 ? 'block' : 'none';
|
||||
}
|
||||
window.addEventListener('resize', checkWidth);
|
||||
checkWidth();
|
||||
|
||||
const links = nav.querySelectorAll('a');
|
||||
const sections = [];
|
||||
links.forEach(a => {
|
||||
const id = a.getAttribute('href').slice(1);
|
||||
const el = document.getElementById(id);
|
||||
if (el) sections.push({
|
||||
el,
|
||||
link: a
|
||||
});
|
||||
});
|
||||
|
||||
function onScroll() {
|
||||
let current = sections[0];
|
||||
for (const s of sections) {
|
||||
if (s.el.getBoundingClientRect().top <= 120) current = s;
|
||||
}
|
||||
links.forEach(a => a.classList.remove('active'));
|
||||
if (current) current.link.classList.add('active');
|
||||
}
|
||||
window.addEventListener('scroll', onScroll, {
|
||||
passive: true
|
||||
});
|
||||
onScroll();
|
||||
})();
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user