/** * 顶部广告位:与生产 stockinfo.full-min.js 的注入行为保持一致。 * 服务端只输出空容器,这里在 DOM 就绪后按配置写入广告 iframe。 */ (function ($) { 'use strict'; // 把 iframe 写入广告容器;id 与尺寸为生产广告位既有配置 function render(slot, id, width, height) { if (!slot || !id) { return; } $(slot).html(''); } // 生产延迟 1 秒加载,避免广告阻塞首屏 $(function () { setTimeout(function () { // 顶部通栏 778x60 render(document.getElementById('ad_1'), '154', '778', '60'); // 页面级广告位,尺寸与 id 由 data 属性声明 $('[data-ad-id]').each(function () { render(this, $(this).attr('data-ad-id'), $(this).attr('data-ad-width'), $(this).attr('data-ad-height')); }); }, 1000); }); }(jQuery));