非常简单的例子:http: //jsbin.com/ohude
单击 button1,“hello2”文本 p 应将 z-index 更改为 89。单击 button2,z-index 应再次更改。这在萤火虫中很明显。但它在 IE8 中不做插孔。
有人可以确认吗?
谢谢。
非常简单的例子:http: //jsbin.com/ohude
单击 button1,“hello2”文本 p 应将 z-index 更改为 89。单击 button2,z-index 应再次更改。这在萤火虫中很明显。但它在 IE8 中不做插孔。
有人可以确认吗?
谢谢。
我没有 IE8,也不知道 jQuery 代码。
您是要更改查看的文本,还是仅更改 z-index?如果 z-index 和查看的文本,在 Safari 中是不行的。
对于我的测试,我将您原来的 jQuery 样式函数更改为:
首先,我将您的 css 更改为 css('zIndex','89') 以查看是否会改变结果。无论是 css('zIndex'...) 还是 css('z-index'...),都对我有用。
正如我所说,我不知道 jQuery。但是在 IE8 中测试了以下代码片段后,如果它不起作用,请尝试将 css arg 更改为“zIndex”,只是为了笑。
测试:
$('#click').click(function () {
$('#hello').css('z-index','89');
var pid = document.getElementById('hello');
alert('pid.style.zIndex: ' + pid.style.zIndex);
pid.firstChild.nodeValue = "Hello2 " + pid.style.zIndex;
});
$('#click2').click(function () {
$('#hello').css('z-index','10');
var pid = document.getElementById('hello');
alert('pid.style.zIndex: ' + pid.style.zIndex);
pid.firstChild.nodeValue = "Hello2 " + pid.style.zIndex;
});
});
很抱歉弄乱了您的 JQuery 代码。:D
您尝试在测试页面中设置 z-index 的元素没有设置 CSS“位置”,因此更改 z-index 实际上不会起作用。
添加位置:相对;或位置:绝对;CSS 属性应该允许您设置它们的 z 索引。