橫幅
指令碼:https://koin-ad.click/banner/v1/main.js
元素:<x-banner>
全域物件:banner
共用方法見 廣告代碼 API。橫幅另外提供 size 屬性。
安裝
html
<script async src="https://koin-ad.click/banner/v1/main.js?id=UNIT_ID"></script>
<x-banner size="728x90"></x-banner>元素可以放在指令碼前面,也可以放在後面。自訂元素完成定義時,指令碼會升級它。
size
size 的寫法是 widthxheight。若缺少,或不在這份清單裡,橫幅會使用 480x60。
size | 適合的位置 |
|---|---|
480x60 | 預設。行動版通欄 |
728x90 | 通欄 |
320x100 | 大型行動橫幅 |
350x250 | 矩形 |
970x90 | 大型通欄 |
元素依照這個比例自己排版。你不必自己設定像素高度。
theme() 名稱
在 banner.theme(css) 裡使用這些選擇器名稱。
| 名稱 | 選取對象 |
|---|---|
banner | <x-banner> 元素 |
container | 橫幅外框 |
adaptive-box | 比例盒 |
content | 素材 |
button-container | 控制項群組 |
micro-label | 小標籤 |
brand-label | 品牌標記 |
badge-icon | 徽章 |
svg-icon | 圖示 |
js
banner.theme(`
banner {
background-color: red;
}
container {
border-radius: 0;
}
`);只有你在 CSS 裡寫下的屬性會改變。預設規則的其餘部分會保留。