所有
在以下代码中
<html>
<head>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="http://jqueryui.com/latest/jquery1.3.2.js">
</script>
<script src="http://jqueryui.com/latest/ui/effects.core.js"></script>
<script src="http://jqueryui.com/latest/ui/effects.slide.js"></script>
<style type="text/css">
#show { margin: 0px; width: 100px; height: 80px; background: green; border: 1px solid black; position: relative; }
</style>
<script>
$(document).ready(function(){
$("#details").mouseover(function() {
$("#show").show("slide", {}, 1000);
});
</script>
</head>
<body>
<div id="details">keyword</div>
<div id="show" style="display:none;"></div>
</body>
我必须将show div放在页面中间鼠标悬停在详细信息div上。你能告诉我它是如何完成的......
由于.........................
答案 0 :(得分:2)
这样的东西?
$("#details").mouseover(function() {
var theTop = ($(window).height() / 2) - $('#show').height();
$("#show").show().css({margin:'0 auto', top:theTop});
});
答案 1 :(得分:0)
如果您正在谈论灯箱效果,那么有很多jQuery插件可供您处理。一些例子:
http://leandrovieira.com/projects/jquery/lightbox/
答案 2 :(得分:0)