jquery---4
来源:互联网 发布:mac怎样下载bilibili 编辑:程序博客网 时间:2024/04/27 22:36
+Changing CSS styles with the css() method
+More animation as you meet jQuery’s animate() method
+Inserting, removing, and moving elements around the DOM
+Editing element attributes with attr()
+A myriad of manipulation methods that jQuery provides
》 If you want to add a class to something, you can do it regardless of whether the element already not.has that class not. there’s no need to check whether an element has a class before you remove that class.
》. slideUp(), slideDown(), slideToggle()
. slideUp will animate an element to a height of 0, creating the effect that the element slides up the page, with its height getting smaller and smaller until it disappears.
想要点击之后再有效果即 $("#box").on("click",function(){$(this).slideUp();});
》Removing Elements from the DOM
jquery里有很多删除元素的方法,.remove( ) .detach( ) empty()
区别:.remove( )会把其他与被修改元素相关的也删除掉,比如这个元素在click里作为eventhandler,remove这个元素后,click就不可用了,而.detach( ) 修改位置后,只要没有把这个元素在DOM中删除掉,在其他位置依旧可以使用。
》Creating New Elements
var newDiv = $("<div></div>", {
"text": "Hello",
"class": "newDiv",
"title": "Hello"
});
》DOM Insertion, Inside:向DOM里添加 append() appendTo() html() prepend() prependTo() text()
append() adds that onto the end of each element in the set。$("p").append(***)元素是添加在<p>内部的。
prepend() will insert elements at the beginning, before all other elements.
appendTo( ),prependTo( )用法与append()相反,但添加位置相同。都是在内部添加。
$("<strong>hello</strong>").appendTo("p")
》DOM Insertion, Outside:after() before() insertAfter() insertBefore()
after() is used to insert content after the elements in your set。$("p")after("***")元素是添加在<p>外部的。
$("<span>Hey</span>").insertAfter("p");
- jquery---4
- JQuery笔记4:JQuery选择器
- JQuery Learning(4):JQuery events
- Jquery<4>Jquery 事件操作
- jQuery日记(4)--jQuery遍历
- Jquery学习4-1---jquery用法之访问jquery对象
- jQuery源码分析4: jQuery.makeArray和jQuery.toArray
- jQuery使用手册(4)
- jQuery技巧总结 [4]
- jQuery使用手册(4)
- JQuery-4事件
- JQuery-4事件
- JQuery-4事件
- JQuery -4 Ajax
- jQuery实例4
- jquery基础4
- jQuery简单例子-4
- jQuery study note 4
- 39个让你受益的HTML5教程
- Windows编程基础 第十二章 磁盘 目录 文件 查找文件
- 对Geoserver2.4.8的跨域访问 CORS
- 手把手教你配置karma
- C++ 初始化列表
- jquery---4
- Service中绑定服务和启动服务的区别
- 实现图片圆角
- ZOJ 3811 Untrusted Patrol 并查集+邻接表,注意所有点都要走过
- Struts2的工作原理
- 在小于99999的正整数中,找出即是完全平方数,又有两位数字相同的数。
- windows上maven安装与使用(基础操作命令)并与eclipse(galileo版)整合教程
- 2、浏览器对象BOM
- c#泛型