简体   繁体   English

不良的JavaScript? hello bar solo仅在主页上起作用-没有其他页面

[英]bad javascript? hello bar solo only working on homepage - no other pages

I'm running a bigcommerce store and have the hello bar solo custom code installed in the site footer. 我正在经营一家bigcommerce商店,并在网站页脚中安装了hello bar单独自定义代码。 I've also tried placement of the hellobar code in various spots (header template files, default template files, page specific template files). 我还尝试将hellobar代码放置在各个位置(标题模板文件,默认模板文件,页面特定的模板文件)。 For some reason the hello-bar only works on my homepage, but never on any of the other pages. 出于某种原因,hello-bar仅在我的主页上起作用,而在其他任何页面上却不起作用。

Any ideas as to why? 有什么想法吗? Seems like if i place this in the footer it should show up on every pages but that's not what i'm getting. 似乎如果我将其放在页脚中,它应该显示在每页上,但这不是我得到的。 please let me know if you need more details or code samples to help. 如果您需要更多详细信息或代码示例以帮助您,请告诉我。

thanks 谢谢

btw, bigcommerce support also thinks that the hellobar should show up on every page if i have this code in the footer, but its not working. 顺便说一句,bigcommerce支持人员还认为,如果我在页脚中有此代码,则hellobar应该显示在每个页面上,但它不起作用。 my guess is that it's the javascript but I dont know my way around that. 我的猜测是这是javascript,但我不知道该如何解决。

Here's the code I'm using: 这是我正在使用的代码:

   <div id="mailchimp_form" style="display:none;">
<form action="http://xxxxx.us5.list-manage.com/subscribe/post" method="POST">
<input type="hidden" name="u" value="xxxxxxxx">
<input type="hidden" name="id" value="xxxxx">
Get an instant coupon code by signing up to our newsletter.  Email: <input type="email" autocapitalize="off" autocorrect="off" name="MERGE0" id="MERGE0" size="25" value="" />
<input class="button" type="submit" value="Subscribe" />
</form>
</div>
<!-- Hello Bar configuration start -->
<script type="text/javascript">
var mailChimpForm = document.getElementById('mailchimp_form').innerHTML;
new HelloBar( mailChimpForm, {
    showWait: 1000,
    positioning: 'sticky',
    fonts: 'Arial, Helvetica, sans-serif',
    forgetful: true
}, 1.0 );
</script>

And here are the references that I've placed in the header: 这是我放在标题中的引用:

<link type="text/css" rel="stylesheet" href="content/hellobar.css" />
<script type="text/javascript" src="content/hellobar.js"></script> 

No idea what bigcommerce is, but judging from what you supplied I am guessing one of two reasons. 不知道什么是bigcommerce,但是从您提供的内容来看,我猜是两个原因之一。

  1. There is no 'mailchimp_form' div except on your homepage. 除了您的首页之外,没有“ mailchimp_form” div。
  2. Javascript, for some weird reason, does get executed before 'mailchimp_form' div gets loaded on all other pages. 出于某种奇怪的原因,JavaScript确实在所有其他页面上加载“ mailchimp_form” div之前执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Magic Line&jQuery origLeft undefined在主页而非其他页面上工作 - Magic Line & jQuery origLeft undefined working on homepage not other pages 为什么我的 GitHub 页面只显示我的 React 应用程序的主页而不显示其他页面? - Why does my GitHub page only show the homepage for my react app and not the other pages? Javascript仅在管理面板中运行,而不在其他页面上运行 - Javascript only running in admin panel, not on other pages 如何使用jquery.cookie仅将cookie设置为主页而不是其他页面 - How to set cookie for homepage only and not other pages using jquery.cookie 我的项目只显示我的主页,没有任何按钮和其他页面 - My project display only my homepage without any buttons and other pages Javascript function 仅适用于一个 class 并忽略具有相同 ZA2F2ED4F8EBC2CBB4C21A29 的其他页面 - Javascript function only working on one class and ignoring the other pages with same class JQuery Mobile中的JavaScript文件无法在其他页面上运行 - JavaScript file in JQuery Mobile not working on other pages jQuery菜单仅在主页上起作用 - JQuery Menu Only Working on Homepage JavaScript中的&#39;hello&#39;==(除“ hello”以外,其他都会返回true的内容)? - 'hello' == (anything that will return true other than 'hello') in JavaScript? Javascript仅在chrome中工作,但没有其他浏览器 - Javascript working only in chrome but none other browser
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM