摘要: jQuery.extend(object) 扩展jQuery对象本身。 用来在jQuery命名空间上增加新函数。 在jQuery命名空间上增加两个函数: <script> jQuery.extend({ min: function(a, b) { return a < b ? a : b; }, m 阅读全文
posted @ 2021-05-11 17:43 映辉 阅读(91) 评论(0) 推荐(0)
摘要: /* //基本 show([s,[e],[fn]]) 显示元素 hide([s,[e],[fn]]) 隐藏元素 //滑动 slideDown([s],[e],[fn]) 向下滑动 slideUp([s,[e],[fn]]) 向上滑动 //淡入淡出 fadeIn([s],[e],[fn]) 淡入 fa 阅读全文
posted @ 2021-05-11 17:41 映辉 阅读(141) 评论(0) 推荐(0)
摘要: 1 - 文本操作 /* $("选择符").html() // 读取指定元素的内容,如果$()函数获取了有多个元素,则提取第一个元素 $("选择符").html(内容) // 修改内容,如果$()函数获取了多个元素, 则批量修改内容 $("选择符").text() // 效果同上,但是获取的内容是纯文 阅读全文
posted @ 2021-05-11 17:40 映辉 阅读(101) 评论(0) 推荐(0)
摘要: /* 三种用法: 1. on 和 off // 绑定事件 $().on("事件名",匿名函数) // 解绑事件,给指定元素解除事件的绑定 $().off("事件名") 2. 直接通过事件名来进行调用 $().事件名(匿名函数) 3. 组合事件,模拟事件 $().ready(匿名函数) // 入口函数 阅读全文
posted @ 2021-05-11 17:29 映辉 阅读(63) 评论(0) 推荐(0)
摘要: 1 - 直接查找 (1)基本选择器 /* #id # id选择符 element # 元素选择符 .class # class选择符 selector1, selector2, selectorN # 同时获取多个元素的选择符 $("#id") $(".class") $("element") $( 阅读全文
posted @ 2021-05-11 17:20 映辉 阅读(327) 评论(0) 推荐(0)
摘要: 1 - onload 事件:加载完成后立即执行 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script> window.onload = function (){ ele 阅读全文
posted @ 2021-05-11 17:09 映辉 阅读(148) 评论(0) 推荐(0)
摘要: <标签名 属性1=“属性值1” 属性2=“属性值2”……>文本</标签名> 1 - 文本操作 <div class="c1"><span>click</span></div> <script> var ele =document.querySelector(".c1"); ele.onclick = 阅读全文
posted @ 2021-05-11 16:50 映辉 阅读(157) 评论(0) 推荐(0)
摘要: 1 - 静态绑定:直接把事件写在标签元素中 <div id="div" onclick="foo(this)">click</div> <script> function foo(self){ // 形参不能是this; console.log("foo函数"); console.log(self) 阅读全文
posted @ 2021-05-11 16:34 映辉 阅读(224) 评论(0) 推荐(0)
摘要: 1 - 直接查找标签 // 方式1:获取元素 document.getElementsByTagName("标签名") document.getElementById("id值") document.getElementsByClassName("类名") // 方式2:css选择器: docume 阅读全文
posted @ 2021-05-11 16:25 映辉 阅读(947) 评论(0) 推荐(0)