上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页
摘要: # 回调地狱 - 因为$.ajax()嵌套过多,导致回调地狱,形成三角形代码 ```js $.ajax({ url: 'https://www.baidu.com',//随便写的地址,不能使用 type: 'GET', success: function (res) { $.ajax({ url:  阅读全文
posted @ 2020-05-15 21:07 lanshanxiao 阅读(713) 评论(0) 推荐(0) 编辑
摘要: # jQuery工具方法 - 1.$.type() 判断数据类型 $.isArray() $.isFunction() $.isWindow() ```js console.log($.type(undefined));//undefined console.log($.type('abc'));/ 阅读全文
posted @ 2020-05-15 10:05 lanshanxiao 阅读(219) 评论(0) 推荐(0) 编辑
摘要: # jQuery遍历索引的方法 - 1.each() ```js $('li').each(function(index, ele){ $(ele).text(index).addClass('demo' + index); }); ``` - 2.children() ```js $('ul'). 阅读全文
posted @ 2020-05-14 08:52 lanshanxiao 阅读(456) 评论(0) 推荐(0) 编辑
摘要: # jQuery位置坐标图形方法 - 1.offset() 返回一个对象,包含left和top属性,当前元素相对于文档的位置 ```js $('.demo').offset();//取值 $('.demo').offset({left:100, top:100});//赋值 ``` - 2.posi 阅读全文
posted @ 2020-05-14 08:11 lanshanxiao 阅读(281) 评论(0) 推荐(0) 编辑
摘要: # jQuery动画 - 1.hide() 隐藏 - 2.show() 展示 ```js $('.demo').show(3000, 'swing');//width height opacity padding 对这些参数同时进行操作 ``` - 3.toggle() 隐藏,展示操作 - 4.fa 阅读全文
posted @ 2020-05-14 06:52 lanshanxiao 阅读(439) 评论(0) 推荐(0) 编辑
摘要: # jQuery事件 - 1.on() ```js //1.事件类型type 2.selector 3.data 4.handle $('ul').on('click', 'li', function(e){ alert($(e.target).text()); });//点击ul下的li元素触发h 阅读全文
posted @ 2020-05-11 11:16 lanshanxiao 阅读(656) 评论(0) 推荐(0) 编辑
摘要: # jQuery中的clone()和data()方法 - clone() ```js $('.demo').clone().appendTo('body');//把.demo元素一级元素的行间样式复制一下添加到body元素下,但是克隆不了绑定的事件 $('.demo').clone(true).ap 阅读全文
posted @ 2020-05-10 21:33 lanshanxiao 阅读(358) 评论(0) 推荐(0) 编辑
摘要: # jQuery操作DOM 和 增删改查 - 1.html() ```js $('ul li').html();//获取ul下第一个li元素下的内容 $('ul li').html('9');//把ul下所有li元素下的内容改为9 $('ul li').html(function(index, el 阅读全文
posted @ 2020-05-10 19:34 lanshanxiao 阅读(290) 评论(0) 推荐(0) 编辑
摘要: # jQuery选择元素 - 1.get() 从jQuery对象中获取某个指定的元素,返回原生的dom对象,所以不能再次链式调用jQuery对象的方法,但是可以使用原生的方法,或者再次封装为jQuery对象 ```js $('demo').get(0). $($('demo').get(0))//再 阅读全文
posted @ 2020-05-09 12:00 lanshanxiao 阅读(433) 评论(0) 推荐(0) 编辑
摘要: # 引入jQuery工具库 ## 下载地址 - cdn:http://www.jq22.com/cdn/#a2 - 下载地址:http://www.jq22.com/jquery-info122 # 文档查询 - 中文:https://www.jquery123.com/ - 英文:https:// 阅读全文
posted @ 2020-05-08 19:01 lanshanxiao 阅读(336) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页