javascript/css转换+;google chrome的z索引问题
谷歌chrome、中央图像有一些问题,但它们没有 请尝试以下代码以重复此问题:javascript/css转换+;google chrome的z索引问题,javascript,css,google-chrome,webkit,transform,Javascript,Css,Google Chrome,Webkit,Transform,谷歌chrome、中央图像有一些问题,但它们没有 请尝试以下代码以重复此问题: <!DOCTYPE html> <html> <head> <script> function big_image(myelem) { myelem.style.webkitTransform = 'scale(2.0)'; myelem.style.zIndex = '99'; } function orig_image(myelem) { myelem.st
<!DOCTYPE html>
<html>
<head>
<script>
function big_image(myelem) {
myelem.style.webkitTransform = 'scale(2.0)';
myelem.style.zIndex = '99';
}
function orig_image(myelem) {
myelem.style.webkitTransform = 'scale(1.0)';
myelem.style.zIndex = 'auto';
}
</script>
</head>
<body>
<img src="http://www.pewforum.org/files/2015/10/PF_15.10.05_PostPapal_promo260x260.jpg" onmouseover="big_image(this);" onmouseout="orig_image(this);">
<img src="http://www.pewforum.org/files/2015/10/PF_15.10.05_PostPapal_promo260x260.jpg" onmouseover="big_image(this);" onmouseout="orig_image(this);">
<img src="http://www.pewforum.org/files/2015/10/PF_15.10.05_PostPapal_promo260x260.jpg" onmouseover="big_image(this);" onmouseout="orig_image(this);">
</body>
</html>
函数大图(myelem){
myelem.style.webkitttransform='scale(2.0)';
myelem.style.zIndex='99';
}
函数源图像(myelem){
myelem.style.webkitttransform='scale(1.0)';
myelem.style.zIndex='auto';
}
如何修复/克服它?
谢谢。z索引和转换属性有一个bug 避免这种情况的最佳方法是重置转换属性onmouseout:
function big_image(myelem) {
myelem.style.webkitTransform = 'scale(2.0)';
myelem.style.zIndex = '2';
}
function orig_image(myelem) {
myelem.style.webkitTransform = 'none';
myelem.style.zIndex = '1';
}
在Chrome/Opera上测试并按预期工作