jQuery学习
文章平均质量分 62
小花fafa
这个作者很懒,什么都没留下…
展开
-
jQuery事件对象,对象拷贝(jQuery禁止默认行为,阻止冒泡,禁止右键)
1.事件对象 语法:element.on(events,[selector],function(event){}) 首先,先准备一个盒子,并为他绑定点击事件: <div></div> <style> div { width: 200px; height: 200px; background-color: pink; } </style> <script> $(..原创 2021-09-07 09:55:07 · 154 阅读 · 2 评论 -
jquery事件(on方法的优点,off方法)(自动触发事件)(事件委托)
1.注册和处理 通过不同类型事件的方法 例如 click(),mouseover(),mouseout()... 先准备一个盒子: <div></div> <style> div { width: 200px; height: 200px; background-color: pink; } </style> 给这个盒子绑定点击事件: (点击...原创 2021-09-06 10:27:54 · 859 阅读 · 0 评论 -
jQuery尺寸,位置操作
1.尺寸 width() | height() 获取宽高,只算width | height 先准备一个盒子: innerWidth() | innerHeight() 包含padding outerWidth() | outerHeight() 包含padding 和 border outerWidth(true) | outerHeight(true) 包含padding ,borde...原创 2021-09-05 10:13:44 · 237 阅读 · 0 评论 -
jQuery元素操作
1.遍历$('选择器').each(function(index,demoFile){ }) ( 注意:这里的demoFile是DOM元素对象)首先我们建立三个div并设置样式: <div>这里是div</div> <div>这里是div</div> <div>这里是div</div> <style> div { width: 200px; height: 50..原创 2021-09-04 09:11:24 · 76 阅读 · 0 评论 -
jQuery内容文本值 (jquery获取输入框中的内容)
1.普通元素内容 html()获取: <div><a href="#">这里是div</a></div> <script> $(function () { console.log($('div').html()); }) </script>设置: <div><a href="#">这里是div</a></div> <.原创 2021-09-03 09:15:20 · 2320 阅读 · 0 评论 -
jQuery属性操作
1.设置或获取元素的固有属性值 prop() 比如<a>里面的href , <input>里面的type 获取属性值: 元素.prop('属性名') <input type="text"> <script> $(function () { console.log($('input').prop('type')); }) </script> 设置属性: 元...原创 2021-09-03 08:48:32 · 54 阅读 · 0 评论 -
jQuery效果(显示与隐藏,滑动效果,动画队列和停止排队,淡入和淡出,自定义动画)
1.显示与隐藏显示 show([speed,[easing],[fn]]) (中括号表示可以省略)speed : (速度) "slow" , "normal" , "fast" , 或者毫秒数(1000 | 2000......) easing : (切换效果) "swing"(先慢后快再慢) , "linear" (匀速) fn : (回调函数),动画完成时执行,每个元素执行一次隐藏 hide([speed,[easing],[fn]])参数含义与显示相同准备一个盒子,...原创 2021-09-02 16:50:53 · 1939 阅读 · 1 评论 -
jQuery操作CSS方法和设置类样式方法
1.操作CSS ---- $('选择器').css('属性名','值') 参数只写属性名,则返回属性值<div></div> <style> div { width: 200px; height: 200px; background-color: pink; } </style> <script> $(function () { conso...原创 2021-09-02 08:50:43 · 819 阅读 · 0 评论 -
jQuery中的一些常用方法(元素显示隐藏,鼠标经过,查找当前元素索引号,清空内容)
1.元素的显示与隐藏$('选择器').show() | $('选择器').hide()利用定时器,每隔1s中切换一种状态<div></div> <style> div { width: 200px; height: 200px; background-color: pink; } </style> <script> $(function () { ..原创 2021-08-23 10:32:21 · 520 阅读 · 0 评论 -
jQuery筛选方法(jQuery选择器)
1.查找父级 $('选择器').parent();2.查找最近一级子元素(亲儿子) $('选择器').children('选择器')3.后代选择器 $('选择器').find('选择器')4.查找兄弟节点(不包括自己本身) $('选择器').siblings('选择器')5.查找当前元素之后的所有元素 $('选择器').nextAll()6.查找当前元素之前的所有元素 $('选择器').prevAll()7.检查当前的元素是否含有某个特定的类 $...原创 2021-08-23 09:53:29 · 2385 阅读 · 0 评论 -
jQuery选择器
$('选择器')例如:$('div') $('.class') $('#mayid')=>隐式迭代:jQuery选择器对元素进行操作,会遍历内部DOM元素 就是给匹配到的所有元素都进行相应的操作注意:例子中的jquery.js的引入地址要换成自己的文件存储地址<script src="../jQuery/jquery.js"></script> <style> div { ...原创 2021-08-19 09:50:05 · 58 阅读 · 0 评论 -
jQuery的初认识 (jquery对象和Dom对象的区别)
jQuery是常见的一个js库js库:是一个封装好的特定的集合(方法和函数)(简单理解就是一个js文件,里面对我们原生js代码进行了封装,存放到里面)我们要学习的内容就是如何调用这些方法(函数)下载:https://jquery.com |https://code.jquery.comjquery的入口函数(相当于DOMContentLoaded)$(function(){ //此处是页面DOM加载完成的入口});$(document).ready(functi...原创 2021-08-19 09:21:27 · 79 阅读 · 0 评论