wordpress边栏随动完美版
相信很多小博主们为了这个边栏随动功能费心不少。最常见的问题就是无限下滚。百度发现知名博客知更鸟的博主发布一篇排名靠前,确实也不是无限滚动了。但是,有的主题底部还有别的容器,且占很多高度,如果在stop position里不把这个值减掉,边栏还会往下滚动这个高度。
以我使用的wordpress twentytwenty主题为例(进行了适当修改,加了边栏), 顶部是 header,中间是wrap,包含了primary和secondary, 底部有个footer-widget和site-footer.
首先在原来的基础上增加了primary和secondary的高度比较,只有primary高度大于secondary时才随动。
其次引入footerHeight这个变量,这个值从footer-widget获取,我给加了个id=“footer_nav”;还有site-footer的高度113.
最后我们在maxPosition 这行再减去footerHeight和113, 这样边栏就随动了底部容器上面停止了。
由于twentytwenty底部widget高度不固定,所以按照上面的方法好操作;如果底部固定不变的话,直接用chrome检查一下底部所有高度,然后在 maxPosition 这行减去就行
附上code.
<script type="text/javascript"> var documentHeight = 0; var topPadding = 15; $(function() { if ($("#primary").height() > $("#secondary").height()) { var offset = $("#secondary").offset(); documentHeight = $(document).height(); $(window).scroll(function() { var footerHeight = 0; if ($('#footer_nav').length > 0) { footerHeight = $('#footer_nav').outerHeight(true); } var sideBarHeight = $("#secondary").height(); if ($(window).scrollTop() > offset.top) { var newPosition = ($(window).scrollTop() - offset.top) + topPadding; var maxPosition = documentHeight - (sideBarHeight + 368 + footerHeight + 113); if (newPosition > maxPosition) { newPosition = maxPosition; } $("#secondary").stop().animate({ marginTop: newPosition }); } else { $("#secondary").stop().animate({ marginTop: 0 }); }; }); }; }); </script>
除非注明,否则均为芯片版图原创文章,转载必须以链接形式标明本文链接
- 浅槽隔离工艺(STI) 15128
- CMOS制作基本步骤 13775
- 关于芯片中的seal ring… 13493
- xbox one要求东方明珠实名认证 13076
- div+css不显示最后一个li标签borde... 12201
- CMOS制造中的轻掺杂漏(LDD)注入工艺 11944
- CMOS制作步骤(一):双阱工艺 11617
- IC封装形式COF介绍 11410
- match of layout(版图中的匹配) 10693
- IC版图设计中电容的基本匹配规则 10101
- Mentor calibre_V2008.1_20_linux_x86 17
- 工艺相关资料合集 13
- skill编写的cadence打label增强程序 13
- calibredrv create reference cell 10
- calibredrv merge GDS file 10
- Cadence Layout Turbo提取PAD坐标 9
- 亲测fedora16安装calibre2008所需... 8
- 博客软件WordPress宣布博客数破5千... 6
- 关于IC版图中的匹配规则 6
- htaccess将多域名301定向到主域名 6
- 关于芯片中的seal ring… 163
- xbox one要求东方明珠实名认证 93
- CMOS制作基本步骤 88
- 关于IC版图中的匹配规则 71
- cadence layoutXL使用简介 68
- 浅槽隔离工艺(STI) 60
- CMOS制造中的轻掺杂漏(LDD)注入工艺 58
- match of layout(版图中的匹配) 58
- IC Layout布局经验 47
- IC版图设计中电阻的匹配基础篇 39
近期评论
- admin posted
- 刘俊杰 posted
- Layout Merge posted
有两个gds(带IO的A.gds和dum.gds)做Layout Merge,能否使合并后的gds仍然保持A.gds的名称呢? 能否指定合并的gds的坐标呢?
- 1054145976 posted
标签
.cdslck
calibre
calibredrv
CMP
ddr
fedora
fedora20
fedora22
gconf-editor
gds
Hercules
ic
ic610
ic5141
icfb
iphone
label
layoutXL
nettran
package
polycide
python
qnap
salicide
SDRAM
seo
skill
spice
TP
transistor
twentytwenty
ubuntu
v2lvs
verilog
virtuoso
windows7
Windows10
wordpress
匹配
半导体
封装
摩尔定律
版图
电梯游戏
集成电路
发表评论