javascript - Debug Counter Code -


i have website inherited web designer has counter on not work. site runs on wordpress 4.5.2 , counter consists of 3 parts. should appear on page https://electratherm.com/ above cumulative fleet runtime.

the first part div tag on page:

<div id="counter" style="text-align: center;"></div> 

the second section edited client, shows towards bottom of source code:

<script> //update next 3 variables once per week using current fleet data  var start_date = new date("june 5, 2016 23:59:00");   // date , time when run hours known  var start_value = 548047;   // run hours known @ date above  var increment = 0.0041;   // 4000 fleet hrs per week = .0050 per sec, how many fleet run hours added every second of day. # of week hours / 7/24/60/60 </script> 

the third part actual javascript file linked lower in source code:

<script src="https://electratherm-electratherm.netdna-ssl.com/wp-content/themes/impreza-child/js/counter.js" type="text/javascript">  // section fleet hours counter here //update next 3 variables once per week using current fleet data //var start_date = new date("february 17, 2015 23:59:00"); // date , time when run hours known //var start_value = 316398; // run hours known @ date above //var increment = 0.0055; // 4000 fleet hrs per week = .0066 per sec, how many fleet run hours added every second of day  var interval = 1; // in seconds var count = 0; var fleetyears = 0;  jquery(document).ready(function() {  var msinterval = interval * 1000;  var = new date();  count = parseint((now - start_date)/msinterval) * increment + start_value;  fleetyears = count / 8766;   document.getelementbyid('counter').innerhtml = "<div class='w-counter-number'>" + number((2)).tolocalestring('en') + " hours</div>"; //simply 'count' if unformatted  window.setinterval( function(){   count += increment;    document.getelementbyid('counter').innerhtml = "<div class='w-counter-number'>" + number(count.tofixed()).tolocalestring('en') + " hours</div>"; //simply 'count' if unformatted  }, msinterval); });  /*  document.getelementbyid('counter').innerhtml = "&nbsp;cumulative fleet runtime: " + number(count.tofixed()).tolocalestring('en') + " hours (" + number(fleetyears.tofixed(2)).tolocalestring('en') + " years)&nbsp;"; //simply 'count' if unformatted  window.setinterval( function(){   count += increment;    document.getelementbyid('counter').innerhtml = "&nbsp;cumulative fleet runtime: " + number(count.tofixed()).tolocalestring('en') + " hours (" + number(fleetyears.tofixed(2)).tolocalestring('en') + " years)&nbsp;"; //simply 'count' if unformatted  }, msinterval); });*/  working not long ago stopped now. not sure going on don't see errors in debug console in firefox. 

jquery never calling ready function.

you seem have issue in plugins.js file on line:

jquery('.w-nav-item a[href*=#]').parents('.w-nav-item').removeclass('current-menu-item'); 

i believe it's caused # not being escaped so:

jquery('.w-nav-item a[href*=\\#]').parents('.w-nav-item').removeclass('current-menu-item'); 

this 'may' what's preventing jquery executing it's ready function, until it's fixed can't tell.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -