Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyang0507 committed May 16, 2024
1 parent a5b33df commit b4b9f5f
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions src/components/Ads.svelte
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
<script>
import { onMount, onDestroy } from 'svelte';
let adClass = 'wwads-horizontal'; // 默认类名
function handleResize() {
if (window.innerWidth < 1280) { // XL 断点
adClass = 'wwads-vertical';
} else {
adClass = 'wwads-horizontal';
}
}
onMount(() => {
handleResize(); // 初始检查
window.addEventListener('resize', handleResize); // 添加监听器
});
onDestroy(() => {
window.removeEventListener('resize', handleResize); // 清理监听器
});
// WWAD
</script>

<div class="flex xl:flex-col not-content">
<div class="w-full xl:flex-1">
<div class="max-w-full xl:max-w-[12rem] w-full pt-4 px-4 text-sm leading-6">
<div class={"wwads-cn " + adClass + " wwads-sticky"} data-id="135" style="min-height: 0; margin-top: 0; border-width: 1px; border-radius: 0.5rem"></div>
<div class="w-full pt-4 px-4 text-sm leading-6">
<div class="wwads-cn wwads-horizontal xl:wwads-vertical wwads-sticky max-w-full xl:max-w-[12rem]" data-id="135" style="min-height: 0; margin-top: 0; border-width: 1px; border-radius: 0.5rem"></div>
</div>
</div>
</div>

0 comments on commit b4b9f5f

Please sign in to comment.