0

我正在使用分支智能横幅

要设置横幅,我将以下代码放入head

<script type="text/javascript">
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode banner closeBanner creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setIdentity track validateCode".split(" "), 0);
branch.init('YOUR-BRANCH-KEY');

branch.banner({
    icon: 'http://icons.iconarchive.com/icons/wineass/ios7-redesign/512/Appstore-icon.png',
    title: 'Branch Demo App',
    description: 'The Branch demo app!',
    position: 'top'
}, {});
</script>

所以它会在每一页的顶部显示横幅。但我希望某些页面在底部显示此横幅。我尝试调用banner特定页面来覆盖它:

branch.banner({
   position: 'bottom'
}, {});

但它不起作用。那么该怎么做呢?谢谢!

4

1 回答 1

1

亚历克斯与 Branch.io 在这里:

如果我理解正确,您将主要智能横幅片段放在<head>整个网站的部分中,然后在某些页面上添加第二次调用它。position: 'bottom'不幸的是,这不会像您想要的那样工作,因为相同的功能被触发两次,并且第一个(在该<head>部分中)优先。

理想的解决方案是在每个页面的部分中设置position: 'bottom'position: 'top'动态设置。<head>实际实施的方法取决于您的网站的设置方式。

或者,您也可以为每个页面单独调用智能横幅(例如,就在之前</body>)。只有当您只有相当少的页面时,这才可能是可管理的。

于 2016-04-14T18:52:51.107 回答