好久没更新了 说实话也不知道说些什么~国庆假期无聊来写点啥~
大家经常可以发现有的网页会显示当前你所在的位置~方便访客。我也没事搞了一下 使用的是JS实现的~因为我的文章层次不多 作用的话不是很明显。紧是一个不一样的思路吧。
function locate(){
var glink= location.href; //当前URL
if(glink.indexOf(".html") > 0 ){ //判断URL中是否包含.html
lotext=$("a.locate:first").text(); //获取a.locate的第一个文本
lohref=$("a.locate:first").attr("href"); //获取a.locate的第一个链接
posttl=$(".post-title-single a").text(); //获取文章标题
$("#locate").html('You are here: <a href="http://www.tnnde.com/" rel="norefresh">Home</a> » <a href="'+lohref+'" rel="norefresh">'+lotext+'</a> » '+posttl+''); //输出
}
}
read more