jquery - Javascript file "FASW transitions" duplicating my header info. How to fix -
ok! i'm working on wordpress site, , javascript add together on supposed do, does...but, when inspect element via safari develop, notice it's loading of headers scripts,meta,styles etc. body head. can't figure out why. here's script looks like:
function ft(params) { var ol= document.addeventlistener?"domcontentloaded":"load"; //on load event var navb = params.navb || "reverse slide"; //backbrowser button effect, default empty var = params.but || false; //allow transitions on input type button var cba = params.cba || function() {}; function adl(url, t, o) { //ajax div load if (window.xmlhttprequest) { r = new xmlhttprequest(); } else if (window.activexobject) { r = new activexobject("microsoft.xmlhttp"); } if (r != undefined) { r.onreadystatechange = function() {ol(r, t, o);}; r.open("get", url, true); r.send(""); } } function ol(r, t, o) { //on load div if (r.readystate == 4) { if (r.status == 200 || r.status == 0) { t.innerhtml = r.responsetext; o(); } else { t.innerhtml="error:\n"+ r.status + "\n" +r.statustext; } } } function de() //div effect { var dochtml = document.body.innerhtml; document.body.innerhtml = ""; var d1 = document.createelement("div"); d1.id = "d1"; d1.style.zindex = 2; d1.style.position = "absolute"; d1.style.width = "100%"; d1.style.height = "100%"; d1.style.left = "0px"; d1.style.top = "0px"; document.body.appendchild(d1); d1.innerhtml = dochtml; var d2 = document.createelement("div"); d2.id = "d2"; d2.style.zindex = 1; d2.style.position = "absolute"; d2.style.width = "100%"; d2.style.height = "100%"; d2.style.left = "0px"; d2.style.top = "0px"; document.body.appendchild(d2); homecoming {d1: d1, d2: d2 }; } function timeouts(e, d1,d2) { settimeout(function() { d1.classname = e + " out"; }, 1); settimeout(function() { d2.classname = e + " in"; }, 1); settimeout(function() { document.body.innerhtml = d2.innerhtml; cba(); }, 706); } function slideto(href, effect, pushstate) { var d = de(); var d1 = d.d1; var d2 = d.d2; adl(href, d2, function() { if (pushstate && window.history.pushstate) window.history.pushstate("", "", href); timeouts(effect,d1,d2); } ); } function dc(e){ //detect click event var o; var o=e.srcelement || e.target; var tn = o.tagname.tolowercase(); if (!but || tn!="input" || o.getattribute("type")!="button") //if not button { //try find anchor parent while (tn!=="a" && tn!=="body") { o = o.parentnode; tn = o.tagname.tolowercase(); } if (tn==="body") return; } var t = o.getattribute("data-ftrans"); if (t) { e.preventdefault(); var hr = o.getattribute("href") || o.getattribute("data-href"); if (hr) slideto(hr, t, true); } } function ae(ev, el, f) { //add event if (el.addeventlistener) // w3c dom el.addeventlistener(ev,f,false); else if (el.attachevent) { // ie dom var r = el.attachevent("on"+ev, f); homecoming r; } } ae("click", window, dc); ae(ol, document, //on load function(ev) { ae("popstate", window, function(e) { //function reload when button clicked slideto(location.pathname, navb, false); }); } ); } here link site: http://www.fasw.ws/faswwp/non-jquery-page-transitions-lightweight/
i assume thats not supposed happen. im trying figure out how maintain clean, , maintain head files loaded in head, , load page content. cannot figure 1 out, help pros needed :)
fasw comes 2 functions serves "hooks" both before , after initializing component. can this:
(function inittrans() { initcomponents(); var params = { /*put options here*/ }; new ft(params); })(); function ontransitionfinished() { initcomponents(); } function initcomponents() { // here set "other" javascript codes } notice how javascript codes executed after loading initial page , 1 time 1 time again after transition happened. anyway, how got work around on 'coz javascript codes won't work loaded fasw via ajax on-the-fly.
javascript jquery html5 wordpress css3
No comments:
Post a Comment