my offset is not getting set
hii i have following code with div but i am not able to get set positions of div
please help ..
<html >
<head>
<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>
</head>
<body>
<div id="popupContact" style="position:absolute;left:100px;top:100px;width:100px;height:50px;background-color:orange;border:1px solid red ;">
</div>
<div id="divtoshow" style="display:none; border:1px solid black;width:200px;height:100px;position:absolute;">
dsfdssd
</div>
</body>
</html>
<script type='text/javascript'>
$(document).ready(function(){
var popup_pos=$('#popupContact').offset();
console.log(popup_pos.top);
console.log(popup_pos.left);
$("#popupContact").hover(function() {
$("#divtoshow").css('position',"absolute");
$("#divtoshow").offset({top:popup_pos.top+20,left:popup_pos.left+20});
$("#divtoshow").show();
}, function() {
$("#divtoshow").hide();
});
});
</script>
please help
regards
rahul