原生
脚本:https://koin-ad.click/native/v1/main.js
元素:<x-native>
全局对象:native
公共方法在 广告代码 API。原生额外有 type 属性。type 决定版式,不跟容器尺寸变化。
接入
给元素一个盒子。广告会铺满这个盒子。
html
<div style="width: 360px; height: 120px">
<script
async
src="https://koin-ad.click/native/v1/main.js?id=UNIT_ID"
></script>
<x-native type="detail"></x-native>
</div>type
type 缺失或不在下表中时,版式是 compact。
type | 版式 | 请求的素材 |
|---|---|---|
compact | 短条,图标在标题旁边 | 64×64 |
detail | 更大的图标和一段描述 | 120×120 |
card | 图片横在顶部 | 430×242 |
html
<x-native type="card"></x-native>theme() 的名字
| 名字 | 选中 |
|---|---|
native | <x-native> 元素 |
card | 整张卡片 |
cover | 图片 |
body | 文字区 |
headline | 标题行 |
brand | 品牌行 |
title | 标题 |
subtitle | 描述 |
action | 行动按钮 |
tools | 工具行 |
tool | 单个工具 |
js
native.theme(`
card {
background: #111;
}
title {
color: white;
}
`);