codecamp

z-index取值规范

z-index取值规范

目前人人页面中的弹层较多,z-index取值也比较随意,导致相互覆盖的情况,有的弹层直接覆盖了顶部导航条。

以下是首页的一些z-index取值比较大的属性设置统计:

header头部导航条1999
账号菜单10001
通知提醒10000
顶部搜索结果弹窗10001
页面内容顶部/publisher1998
publisher电影搜索提示1000
用户等级与登录信息提醒1999
回到顶部按钮999 in css, 1001 in html
@10001
表情10001
名片卡9999
底部工具条与webpager/radio1000 in css, 1999 in html
照片浏览弹层5000
照片多张上传弹层3001
XN默认弹层组件10000
首页应用中心推荐弹层1002
HTML5拖拽上传999998

其他z-index设置:

.dropmenu-holder999999
.appsMenuPro10001
.search-Result10002 !important
.menu-dropdown200
.site-nav .navigation981
.mentionFrdList10002!important
.app-center-popup1002
.feed-back-v61999
#appcardcontent1998
.feed-comment-attach1000
.message-box1000
#friendcreate-box100

这些z-index设置,极有可能造成相互覆盖,存在潜在的问题风险。例如:

  1. 1、publisher在导航条以下,但是在publisher中弹出的@、表情却在导航条以上。

  2. 2、XN的默认弹层样式穿透导航条

  3. 3、@组件与名片卡组件相互重叠

因此,有必要对z-index取值进行规范和约束。避免前端开发人员为了自己开发的功能能够正确展示,而忽略了其他组件的展示需求。

如果要为弹层设置z-index,请务必按照给定的取值区间来进行设置。

这里只是初稿,可能还需要精确到某一个组件的z-index分配,需要大家集思广益(可以参考cookie的设置流程,在使用z-index时必须经过审批)

头部导航区域[1999 - 2100]
publisher所在的内容head区[1998]
页面主要内容区域[-1 - 1997]
页面底部[1999 - 2100]
首页应用弹层[1000]
全站公共组件[-1 - 1999]
全页面蒙层弹窗组件[10000-11000]


hack使用规范
常用的CSS命名
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }