Core code:
Copy Code code as follows:
<script type= "Text/javascript" src= "Http://demo.jb51.net/jslib/jquery/jquery-1.7.2.min.js" ></script>
<script type= "Text/javascript" >
$ (function () {
$ (window). Scroll (function () {
var top = $ (window). scrolltop () +200;
var left= $ (window). scrollleft () +320;
$ ("#editInfo"). CSS ({left:left + "px", Top:top + "px"});
});
});
</script>
<div id= "Editinfo" style= "Float:left;width:300px;background-color: #ccc;p osition:absolute;top:200px;" >
<div> User name: <input type= "Text"/></div>
<div> Password: <input type= "Text"/></div>
<div> Age: <input type= "Text"/></div>
<div> Note: <input type= "Text"/></div>
<div><input type= "button" value= "Save"/></div>
</div>
<div style= "height:1500px" ></div>
Online Demo http://demo.jb51.net/js/2012/jquery_demo/jquery_div.html
Remember to write such a code before the trouble, now have a jquery more simple, a few lines of code to fix!