Login
·
Signup
Home
»
XtGem
»
Tips and code snippets
»
[Ask] How to create breadcrumb link?
» View post
CloudVibe
Use this
<style> .ptp{margin:1px;background:#fff} .ptp span{color:#000;margin-left:1px;display:inline-block;padding:2px;font-weight:bold} .ptp span a{background:#d20808;color:#fff;padding:2px;margin-right:2px} </style> <script id="ptp"> var ed=document,ep=location.pathname.slice(1),epa=ep.split("/"),ediv=ed.createElement("div"),dp=ed.getElementById("ptp"),el=epa.length-1;ediv.className="ptp"; //Home Link var hc=ed.createElement("span"),hl=ed.createElement("a"); hl.href="/"; hl.appendChild(ed.createTextNode("Home"));hc.appendChild(hl);ediv.appendChild(hc); for(i=0;i<el;i++){var espan=ed.createElement("span"); var ea=ed.createElement("a"); (function(e){var i=0;epl="";for(i=0;i<e+1;i++){epl+="/"+epa[i];}}(i));ea.href=epl; ea.appendChild(ed.createTextNode(epa[i])); espan.appendChild(ea); ediv.appendChild(espan);} //Active Page var ac=ed.createElement("span"); ac.appendChild(ed.createTextNode(ed.title)); ediv.appendChild(ac); dp.parentNode.insertBefore(ediv,dp); //Set Dividers var evid=ed.querySelectorAll("div.ptp span a"); for(i=0;i<evid.length;i++){var edtxt=ed.createTextNode("ยป");evid[i].parentNode.appendChild(edtxt);} </script>
#
2016-12-05 15:25 ·
(0)
Home
»
XtGem
»
Tips and code snippets
»
[Ask] How to create breadcrumb link?
» View post
Online: Guests: 1
Log in