标签归档:jQuery

jQuery stop()

jQuery stop() 方法用于停止动画或效果,在它们完成之前。

stop() 方法适用于所有 jQuery 效果函数,包括滑动、淡入淡出和自定义动画。
语法
$(selector).stop(stopAll,goToEnd);
可选的 stopAll 参数规定是否应该清除动画队列。默认是 false,即仅停止活动的动画,允许任何排入队列的动画向后执行。

可选的 goToEnd 参数规定是否立即完成当前动画。默认是 false。

因此,默认地,stop() 会清除在被[......]

Read more

jQuery animate()

语法:
$(selector).animate({params},speed,callback);
默认地,所有 HTML 元素都有一个静态位置,且无法移动。如需对位置进行操作,要记得首先把元素的 CSS position 属性设置为 relative、fixed 或 absolute!
$("button").click(function(){
$("div").animate({left:'+=100px',height:'150px'},"slow")
.animate([......]

Read more

jQuery选择器

<html>
<head>
    <title>Selector</title>
    <script src="../scripts/jquery-1.2.3.intellisense.js" type="text/javascript"></script>
</head>
<body>
    <input value="1" /> + 
    <input [......]

Read more

jQuery 语法

jQuery 语法是为 HTML 元素的选取编制的,可以对元素执行某些操作。

基础语法是:$(selector).action()

美元符号定义 jQuery
选择符(selector)“查询”和“查找” HTML 元素
jQuery 的 action() 执行对元素的操作

示例
$(this).hide() - 隐藏当前元素

$("p").hide() - 隐藏所有<p> 元素

$(".test").hide() - 隐藏所有 class=[......]

Read more

jQuery里$(this)和this的区别

如果你要使用html元素本身的属性或方法就需要使用this,如果你要使用jQuery包装后的方法或属性就要$(this),一般则有如下的关系.
$(this)[0] == this;
上文的代码是要使用this的地方是要调用表单form的有reset方法,而这一方法jQuery没有包装支持,所以才有this.reset(),也可以使用$(this)[0].reset();

关于什么时候使用二者?可以看如下例子:
<a href="http://segmentfault.com/[......]

Read more