1、新建模板,命名为:
输入内容:
[CSS] 纯文本查看 复制代码 function scheight() {
return ('pageYOffset' in window) ? window.pageYOffset : document.compatMode === "BackCompat" && document.body.scrollTop || document.documentElement.scrollTop
}
function getleft(obj) {
return $jq(obj).offset().left
}
function gettop(obj) {
return $jq(obj).offset().top
}
function getheight(obj) {
return $jq(obj).css("height").replace("px", "") - 0
}
menuheight = getheight($("menu"));
pa = $jq("td.postauthor[rowspan=2]");
ph = new Array();
pb = new Array();
function interauthor() {
pa = $jq("td.postauthor[rowspan=2]");
for (i = 0; i < pa.length; i++) {
pb[i] = $jq(".author")[i];
ph[i] = [gettop(pa[i]) - menuheight, gettop(pa[i]) + getheight(pa[i]) + (pa.eq(i).css("padding-top").replace("px", "") - 20), getheight(pb[i]) + gettop(pa[i])]
}
};
$jq(document).ready(function() {
function windowscroll() {
interauthor();
var st = scheight();
for (i = 0; i < pa.length; i++) {
if (ph[i][0] < st) {
if (st - ph[i][0] < ph[i][1] - ph[i][2]) {
pb[i].style.position = "fixed";
$jq(pa[i]).css("padding-top", "0px")
} else {
pb[i].style.position = "";
$jq(pa[i]).css("padding-top", (ph[i][1] - ph[i][2]) + "px")
}
} else {
pb[i].style.position = "";
$jq(pa[i]).css("padding-top", "0px")
}
}
}
$jq(document).scroll(function() {
windowscroll()
})
});
2、把下面的代码添加到第三方:
[CSS] 纯文本查看 复制代码 <script type="text/javascript" src="templates/你的模板名称/touxiang.htm"></script>
注:记得修改“你的模板名称” |