【发布时间】:2018-01-29 10:47:01
【问题描述】:
基本上我正在尝试创建一个放置在右侧的侧面板,当鼠标悬停在 ie11 和 chrome 上时,它会打开,出来时会关闭。所以这是代码在 chrome 中运行良好,但不是在ie11。在 ie11 中,它扩散到视图的下半部分,我希望它覆盖中间的一部分并完美地定位在中间。任何帮助将非常感激。我发现问题出在 css 变换中:translateY 尝试过 -ms-transform -webkit-transform 没有任何效果。 .这里是代码:
<html>
<head><title>Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
</head>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"
integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E="
crossorigin="anonymous"></script>
<body>
<div id="panel">
<div id="panel-content">
</div>
</div>
</body>
</html>
<script>
$(function () {
//Function to show side panel on hover
var $pCont = $("#panel-content");
$pCont.width(0);
$('#panel').mouseenter(function(){
$pCont.stop().animate({width: 27}, 200);
});
//Animation for closing the sidepanel when mouseleave
$('#panel').mouseleave(function(){
$("#panel-collapse").hide("slide", { direction: "right" }, 300,function(){
$pCont.stop().animate({width: 0}, 200);
});
});
});
</script>
<style>
#panel
{
position: fixed;
right: 0;
height:180px;
width:27px;
margin-top: 50vh;
transform: translateY(-50%);
}
#panel-content
{
border-radius: 10px 0px 0px 10px;
position: fixed;
right: 0;
background: black;
height:100%;
}
</style>
【问题讨论】:
-
你真的把你的
<script>和<style>放在<html>标签后面了吗?
标签: css google-chrome transform internet-explorer-11