为了账号安全,请及时绑定邮箱和手机立即绑定

固定了导航栏,下方有iframe,iframe内容较长。然后滚动后上方的导航栏就会挡住

固定了导航栏,下方有iframe,iframe内容较长。然后滚动后上方的导航栏就会挡住

撒科打诨 2018-10-17 13:19:57
内容代码控制导航栏的js,都用了jq$(function () {           var ie6 = /msie 6/i.test(navigator.userAgent)           , dv = $('header'), st;           dv.attr('otop', dv.offset().top); //存储原来的距离顶部的距离           $(window).scroll(function () {               st = Math.max(document.body.scrollTop || document.documentElement.scrollTop);               if (st >= parseInt(dv.attr('otop'))) {                   if (ie6) {//IE6不支持fixed属性,所以只能靠设置position为absolute和top实现此效果                       dv.css({ position: 'absolute', top: st });                   }  //其他浏览器则直接加上fixed属性                 else if (dv.css('position') != 'fixed') dv.css({ 'position': 'fixed', top: 0 });               } else if (dv.css('position') != 'static') dv.css({ 'position': 'static' });           });       });
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 707 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信