IE7和IE8出现的计算判断问题
2014-03-06 18:56
197 查看
吸住底部菜单
IE7和IE8下会卡死的算法
修正后的算法,并且改为fixed定位后不会闪烁
IE7和IE8下会卡死的算法
#contact{position:relative; height:61px; width:100%; display:inline-block; background:#f9f9f9; z-index:999; }
function fixedBar(){ var _height=$(this).height()+$(this).scrollTop(); var _top=$("#contact").offset().top; var _bar=$("#contact").height(); if($(this).height()+$(this).scrollTop()<_top+_bar){ $("#contact").css({"position":"absolute","top":_height-_bar+"px","box-shadow":"0px 1px 10px 0px #cccccc"}); //$("#contact").css({"position":"fixed","bottom":"0px","box-shadow":"0px 1px 10px 0px #cccccc"}); } else{ $("#contact").css({"position":"relative","display":"block","top":"0px","box-shadow":"none"}); } }
修正后的算法,并且改为fixed定位后不会闪烁
#contact{position:relative; height:61px; width:100%; display:inline-block; background:#f9f9f9; z-index:999; bottom:0; }
var _isFrist=false;
function fixedBar(){ var _bar=$("#contact").height(); var bottomHeight=118+(48*3); if($(this).scrollTop()<=document.body.clientHeight-bottomHeight-$(window).height()){ if(_isFrist){ document.getElementById("contact").style.position="fixed"; } }else{ _isFrist=true; if($(this).scrollTop()>=document.body.clientHeight-bottomHeight-$(window).height()+_bar){ document.getElementById("contact").style.position="relative"; } //$("#contact").css({"position":"relative","display":"block","top":"0px","box-shadow":"none"}); } }
相关文章推荐
- 用源码包来实现LAMP 的详细过程
- 在 SQL Server 2008 中新建用户登录并指定该用户的数据库
- Hadoop FS Shell命令
- GCC的使用
- 支持向量机 support vector machine
- J2EE中MVC的工作流程
- Ubuntu 12.10 安装 jdk-7u10-linux-x64.tar.gz
- Linux命令的一般格式
- Emacs如何256色
- Django错误 - ImportError: No module named django.core.management
- 归并求逆序对数
- hdu 2639Bone Collector II 01背包第k大问题
- ARM920T cpu SVC32工作模式配置
- Git学习
- linux环境下 C++性能测试工具 gprof 和gprof2dot
- Linux NIS服务器配置
- linuix下递归删除svn文件
- Android APK反编译详解
- IOS-UITableView之刷新某一行
- 全排列的个数