jquery - Javascript tab menu loading after Google Ads -


i utilized tab menu written in html , css , running javascript. tab menu can seen working here dd tab menu. works great except 1 issue: when add google ads, not load until google ads loaded. google ads set 'async' supposed load last.

usually 1 doesn't notice, times when there problem google ads network, tab menu not load. not figure out why. javascript tab menu is:

     var tabmenu={     disabletablinks: true,      snap2original: [false, 300],       currentpageurl: window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, ""),   definemenu:function(tabid, dselected){     this[tabid+"-menuitems"]=null     this[tabid+"-dselected"]=-1     this.addevent(window, function(){tabmenu.init(tabid, dselected)}, "load") },  showsubmenu:function(tabid, targetitem){     var menuitems=this[tabid+"-menuitems"]     this.clearrevert2default(tabid)  (i=0; i<menuitems.length; i++){         menuitems[i].classname=""         if (typeof menuitems[i].hassubcontent!="undefined")             document.getelementbyid(menuitems[i].getattribute("rel")).style.display="none"     }     targetitem.classname="current"     if (typeof targetitem.hassubcontent!="undefined")         document.getelementbyid(targetitem.getattribute("rel")).style.display="block" },  isselected:function(menuurl){     var menuurl=menuurl.replace("http://"+menuurl.hostname, "").replace(/^\//, "")     return (tabmenu.currentpageurl==menuurl) },  iscontained:function(m, e){     var e=window.event || e     var c=e.relatedtarget || ((e.type=="mouseover")? e.fromelement : e.toelement)     while (c && c!=m)try {c=c.parentnode} catch(e){c=m}     if (c==m)         return true     else         return false },  revert2default:function(outobj, tabid, e){     if (!tabmenu.iscontained(outobj, tabid, e)){         window["hidetimer_"+tabid]=settimeout(function(){             tabmenu.showsubmenu(tabid, tabmenu[tabid+"-dselected"])         }, tabmenu.snap2original[1])     } },  clearrevert2default:function(tabid){  if (typeof window["hidetimer_"+tabid]!="undefined")         cleartimeout(window["hidetimer_"+tabid]) },  addevent:function(target, functionref, tasktype){ //assign function execute event handler (ie: onunload)     var tasktype=(window.addeventlistener)? tasktype : "on"+tasktype     if (target.addeventlistener)         target.addeventlistener(tasktype, functionref, false)     else if (target.attachevent)         target.attachevent(tasktype, functionref) },  init:function(tabid, dselected){     var menuitems=document.getelementbyid(tabid).getelementsbytagname("a")     this[tabid+"-menuitems"]=menuitems     (var x=0; x<menuitems.length; x++){         if (menuitems[x].getattribute("rel")){             this[tabid+"-menuitems"][x].hassubcontent=true             if (tabmenu.disabletablinks)                 menuitems[x].onclick=function(){return false}             if (tabmenu.snap2original[0]==true){                 var submenu=document.getelementbyid(menuitems[x].getattribute("rel"))                 menuitems[x].onmouseout=function(e){tabmenu.revert2default(submenu, tabid, e)}                 submenu.onmouseover=function(){tabmenu.clearrevert2default(tabid)}                 submenu.onmouseout=function(e){tabmenu.revert2default(this, tabid, e)}             }         }         else //for items without submenu, add onmouseout effect             menuitems[x].onmouseout=function(e){this.classname=""; if (tabmenu.snap2original[0]==true) tabmenu.revert2default(this, tabid, e)}         menuitems[x].onmouseover=function(){tabmenu.showsubmenu(tabid, this)}         if (dselected=="auto" && typeof setalready=="undefined" && this.isselected(menuitems[x].href)){             tabmenu.showsubmenu(tabid, menuitems[x])             this[tabid+"-dselected"]=menuitems[x]             var setalready=true         }         else if (parseint(dselected)==x){             tabmenu.showsubmenu(tabid, menuitems[x])             this[tabid+"-dselected"]=menuitems[x]         }     } } } 

any assistance appreciated. in advance.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -