手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >基于jquery的DIV随滚动条滚动而滚动的代码
基于jquery的DIV随滚动条滚动而滚动的代码
摘要:核心代码:复制代码代码如下:$(function(){$(window).scroll(function(){vartop=$(window...

核心代码:

复制代码 代码如下:

<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">

<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>

<div></div>

在线演示 http://demo.jb51.net/js/2012/jquery_demo/jquery_div.html

记得以前写这样的代码比较麻烦,现在有了JQuery简单多了,就几行代码搞定!

【基于jquery的DIV随滚动条滚动而滚动的代码】相关文章:

强制设为首页代码

光标定位等TextRange的操作的范例代码

基于javascript简单实现对身份证校验

些很实用且必用的小脚本代码

基于jQuery实现的无刷新表格分页实例

用javascript动态注释掉HTML代码

原生JS和JQuery动态添加、删除表格行的方法

javascript 动态添加表格行

jQuery解析XML文件同时动态增加js文件的方法

JS实现窗口加载时模拟鼠标移动的方法

精品推荐
分类导航