Reputation: 34170
All,
In the following code
<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>
I have to place the show div at the middle of the page on mouseover on details div.Can u tell me how it can be done.....
Thanks.........................
Upvotes: 1
Views: 538
Reputation: 322492
Something like this?
$("#details").mouseover(function() {
var theTop = ($(window).height() / 2) - $('#show').height();
$("#show").show().css({margin:'0 auto', top:theTop});
});
Upvotes: 2
Reputation: 5264
Since you're already using the jQuery UI, I think the dialog component would be an easy way to make it happen.
Upvotes: 0
Reputation: 37081
If you're talking about a lightbox effect, there are lots of jQuery plugins available to handle this for you. Some examples:
http://leandrovieira.com/projects/jquery/lightbox/
http://colorpowered.com/colorbox/
http://jqueryui.com/demos/dialog/
Upvotes: 0