I remember that writing this kind of code used to be troublesome, but now it’s much easier with JQuery. It only takes a few lines of code!
<script type="text/javascript" src="Js/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;position:absolute;top:200px;"> <div>用户名:<input type="text" /></div> <div>密码:<input type="text" /></div> <div>年龄:<input type="text" /></div> <div>备注:<input type="text" /></div> <div><input type="button" value="保存" /></div> </div>
The above implementation code for DIV to scroll as the scroll bar scrolls [recommended] is all the content shared by the editor. I hope it can give you a reference, and I hope you will support Script Home.