<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IInterest &#187; jQuery</title>
	<atom:link href="http://www.iinterest.net/category/javascript/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iinterest.net</link>
	<description>关注移动互联网 &#38; HTML5</description>
	<lastBuildDate>Sat, 07 Jan 2012 08:07:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>[转]14条关于jQuery的知识</title>
		<link>http://www.iinterest.net/2010/09/27/%e8%bd%ac14%e6%9d%a1%e5%85%b3%e4%ba%8ejquery%e7%9a%84%e7%9f%a5%e8%af%86/</link>
		<comments>http://www.iinterest.net/2010/09/27/%e8%bd%ac14%e6%9d%a1%e5%85%b3%e4%ba%8ejquery%e7%9a%84%e7%9f%a5%e8%af%86/#comments</comments>
		<pubDate>Mon, 27 Sep 2010 02:24:38 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=1013</guid>
		<description><![CDATA[以下是译文 如果说jQuery也有缺点，那就是它太容易上手了，所以吸引了大量没有任何JavaScript的新手来使用。一方面来说，这真的很神奇。另一方面，这也导致了一大堆糟糕的代码诞生（有一些是出自我手！） 但是没关系，糟糕的代码是你的成年礼，关键是要越过这道坎，这就是今天要讨论的内容。 1.一些方法会返回jQuery对象 大多数方法会返回jQuery对象。这是很棒的特性，使得我们的代码可以像锁链一样从头到尾链起来。 $someDiv .attr('class', 'someClass') .hide() .html('new stuff'); 这样做的好处是：1.代码更加简洁 2.减少了我们必须遍历整个DOM来寻找这个元素的时间 2.The Find Selector 只要你的选择符不要烂的跟屎一样，jQuery都能帮你方便地找到需要的元素，你不需要操心细节。但是有一些细节你可以注意一下，以此来提高你的JavaScript执行性能。 其中之一就是，只要有可能，就使用.find()方法。主要原因就是：如果不是必不得已，那就不要让jQuery使用它的Sizzle引擎。当然，也会有些情况不能用find()方法，那也没有关系，只要知道有这个区别就好。 // 在现代浏览器上都可以正常运行，但是却是通过Sizzle引擎来完成的 $('#someDiv p.someClass').hide(); // 一样正常运行，原生浏览器支持，效率更高 $('#someDiv').find('p.someClass').hide(); 除IE6/7的现代浏览器都有QuerySelectorAll支持，能允许你传递一个像一样的CSS选择器，而不需要用到jQuery的内部代码。jQuery会在使用自己的引擎之前检查是否存在这个函数。 但对于IE6/IE7而言，就会需要jQuery使用Sizzle引擎，这是一套十分强大的引擎，但非常复杂。简单的说，jQuery会把你的选择器转化成一个数组，并且通过从后往前的方法来迭代匹配。 // 数组 ['#someDiv, 'p']; 它会从右到左，通过正则表达式匹配页面每一个元素，也就是说，你的选择器最右边一定要尽可能的明确，比如ID或者标签名。 底线是： 1.保持代码简单 2.使用find()方法，这样的话，我们就能够使用浏览器的原生查找函数 3.当使用Sizzle的时候，尽可能地把最右边的部分指明，比如ID或者标签名 3.不要滥用$(this) 如果不了解基本的DOM属性和方法的话，很容易滥用jQuery对象。例如 $('#someAnchor').click(function() { &#8230; <a href="http://www.iinterest.net/2010/09/27/%e8%bd%ac14%e6%9d%a1%e5%85%b3%e4%ba%8ejquery%e7%9a%84%e7%9f%a5%e8%af%86/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>以下是译文</p>
<p>如果说jQuery也有缺点，那就是它太容易上手了，所以吸引了大量没有任何JavaScript的新手来使用。一方面来说，这真的很神奇。另一方面，这也导致了一大堆糟糕的代码诞生（有一些是出自我手！）</p>
<p>但是没关系，糟糕的代码是你的成年礼，关键是要越过这道坎，这就是今天要讨论的内容。<br />
<span id="more-1013"></span></p>
<h2>1.一些方法会返回jQuery对象</h2>
<p>大多数方法会返回jQuery对象。这是很棒的特性，使得我们的代码可以像锁链一样从头到尾链起来。</p>
<pre><code>$someDiv
.attr('class', 'someClass')
.hide()
.html('new stuff');
</code></pre>
<p>这样做的好处是：1.代码更加简洁 2.减少了我们必须遍历整个DOM来寻找这个元素的时间</p>
<h2>2.The Find Selector</h2>
<p>只要你的选择符不要烂的跟屎一样，jQuery都能帮你方便地找到需要的元素，你不需要操心细节。但是有一些细节你可以注意一下，以此来提高你的JavaScript执行性能。</p>
<p>其中之一就是，只要有可能，就使用.find()方法。主要原因就是：如果不是必不得已，那就不要让jQuery使用它的Sizzle引擎。当然，也会有些情况不能用find()方法，那也没有关系，只要知道有这个区别就好。</p>
<pre><code>// 在现代浏览器上都可以正常运行，但是却是通过Sizzle引擎来完成的
$('#someDiv p.someClass').hide();

// 一样正常运行，原生浏览器支持，效率更高
$('#someDiv').find('p.someClass').hide();
</code></pre>
<p>除IE6/7的现代浏览器都有QuerySelectorAll支持，能允许你传递一个像一样的CSS选择器，而不需要用到jQuery的内部代码。jQuery会在使用自己的引擎之前检查是否存在这个函数。</p>
<p>但对于IE6/IE7而言，就会需要jQuery使用Sizzle引擎，这是一套十分强大的引擎，但非常复杂。简单的说，jQuery会把你的选择器转化成一个数组，并且通过从后往前的方法来迭代匹配。</p>
<pre><code>// 数组
 ['#someDiv, 'p'];
</code></pre>
<p>它会从右到左，通过正则表达式匹配页面每一个元素，也就是说，你的选择器最右边一定要尽可能的明确，比如ID或者标签名。</p>
<p>底线是：</p>
<p>1.保持代码简单</p>
<p>2.使用find()方法，这样的话，我们就能够使用浏览器的原生查找函数</p>
<p>3.当使用Sizzle的时候，尽可能地把最右边的部分指明，比如ID或者标签名</p>
<h2>3.不要滥用$(this)</h2>
<p>如果不了解基本的DOM属性和方法的话，很容易滥用jQuery对象。例如</p>
<pre><code>$('#someAnchor').click(function() {
	// 又生成了一次jQuery对象
	alert( $(this).attr('href') );
});</code></pre>
<p>如果只是为了获取某a的href属性可以简单地用以下代码：</p>
<pre><code>
$('#someAnchor').click(function() {
	// 没有jQuery对象
	alert( this.href );
});</code></pre>
<h2>4.jQuery的快速ready方法</h2>
<p>原生的ready方法是这样的</p>
<pre><code>$(document).ready(function() {
	// let's get up in heeya
});</code></pre>
<p>而jQuery的方法是这样的：</p>
<pre><code>$(function() {
	// let's get up in heeya
});
</code></pre>
<p>看上去有点困扰+不放心？别担心，看看jQuery的源码：</p>
<pre><code>
// HANDLE: $(function)
// Shortcut for document ready
if ( jQuery.isFunction( selector ) ) {
	return rootjQuery.ready( selector );
}</code></pre>
<p>完全一样的哦</p>
<h2>5.代码安全</h2>
<p>如果希望代码能和其他人协同工作的话，一定要确保不要命名冲突。万一在你的脚本之后导入了其他人的代码，对方用到了$变量，那该怎么办呢？</p>
<p>第一种方法，noConflict()方法：</p>
<pre><code>var j = jQuery.noConflict();
// Now, instead of $, we use j.
j('#someDiv').hide();

// The line below will reference some other library's $ function.
$('someDiv').style.display = 'none';
</code></pre>
<p>第二种方法，把你的代码放在一个匿名函数里面，然后把jQuery作为参数传递给它，那么在这个函数体中的$是不会影响外面或者被外面影响的。</p>
<pre><code>(function($) {
	// Within this function, $ will always refer to jQuery
})(jQuery);
</code></pre>
<p>第三种方法，</p>
<pre><code>jQuery(document).ready(function($) {
 // $ refers to jQuery
});

// $ is either undefined, or refers to some other library's function.
</code></pre>
<h2>6.写聪明的代码</h2>
<pre><code>someDivs.each(function() {
	$('#anotherDiv')[0].innerHTML += $(this).text();
});
</code></pre>
<p>以上代码的糟糕之处在于：<br />
1.在每一次遍历循环中都会搜寻anotherDiv 这个ID的元素<br />
2.两次获取innerHTML属性<br />
3.创建了一个jQuery对象，只是为了获取元素的text属性</p>
<pre><code>var someDivs = $('#container').find('.someDivs'),
      contents = [];

someDivs.each(function() {
	contents.push( this.innerHTML );
});
$('#anotherDiv').html( contents.join('') );
</code></pre>
<p>这样，在每一个遍历循环中所做的操作仅仅是把元素放进一个数组中。这一条tip更适用于所有的JavaScript代码，而不仅仅是jQuery。</p>
<p>说到这儿，就不得不提一下Document编程（Document Fragments），基本上也是说，用原生的js对象，而不是jQuery对象，更有效率。</p>
<pre><code>var someDivs = $('#container').find('.someDivs'),
      contents = [];

someDivs.each(function() {
	contents.push( this.innerHTML );
});
$('#anotherDiv').html( contents.join('') );
</code></pre>
<p>越久使用jQuery和JavaScript，你就会发现你更喜欢用js完成某些简单任务，多好！</p>
<p>jQuery提供了一个很高的抽象程度，但这不意味着我们应该停止学习如何使用原生的js方法，例如上面的代码中我们就用了jQuery的each方法。</p>
<h2>7.Ajax方法</h2>
<p>一个新手开始学习jQuery和Ajax的时候，它提供的诸多接口可能让你困扰。其实很多方法都是helper method（译者注：我专门查了下helper method和jQuery UI里helper的区别，下一篇post详细地说一下）。我们经常用到的方法不过以下几种：</p>
<ul>
<li><strong>get</strong></li>
<li><strong>getJSON</strong></li>
<li><strong>post</strong></li>
<li><strong>ajax</strong></li>
</ul>
<p>以下是getJSON的调用语法</p>
<pre><code>$.getJSON('path/to/json', function(results) {
	// callback
	// results contains the returned data object
});
</code></pre>
<p>这是实现代码：</p>
<pre><code>getJSON: function( url, data, callback ) {
	return jQuery.get(url, data, callback, "json");
}
</code></pre>
<p>进入下一层梦境：</p>
<pre><code>get: function( url, data, callback, type ) {
	// shift arguments if data argument was omited
	if ( jQuery.isFunction( data ) ) {
		type = type || callback;
		callback = data;
		data = null;
	}

	return jQuery.ajax({
		type: "GET",
		url: url,
		data: data,
		success: callback,
		dataType: type
	});
}
</code></pre>
<p>最终，还是通过ajax()方法来执行这么多的操作，它是保证跨浏览器操作的基础。</p>
<p>也就是说你可以直接使用ajax()方法来完成所有的ajax操作，而不是一大堆的helper method。</p>
<p>原来是这样的代码：</p>
<pre><code>$.getJSON('path/to/json', function(results) {
	// callback
	// results contains the returned data object
});
</code></pre>
<p>更高效（并且接口统一）的代码：</p>
<pre><code>$.ajax({
	type: 'GET',
	url : 'path/to/json',
	data : yourData,
	dataType : 'json',
	success : function( results ) {
		console.log('success');
	})
});
</code></pre>
<h2>8.获取原生js属性和方法</h2>
<p>从之前的例子中我们学到我们可以直接取得元素比如a标签的属性：</p>
<pre><code>var anchor = document.getElementById('someAnchor');
//anchor.id
// anchor.href
// anchor.title
// .etc
</code></pre>
<p>但是当你想通过jQuery取得DOM元素的时候，是不能通过这种方法来取得属性的：</p>
<pre><code>// Fails
var id = $('#someAnchor').id;
</code></pre>
<p>所以，当你需要获取href属性或者其他属性的是，你需要使用其他方法，方法很多：</p>
<pre><code>// OPTION 1 - Use jQuery
var id = $('#someAnchor').attr('id');

// OPTION 2 - 取到DOM元素再取值
var id = $('#someAnchor')[0].id;

// OPTION 3 - 用jQuery的get方法
var id = $('#someAnchor').get(0).id;

// OPTION 3b - 用不带参数的get
anchorsArray = $('.someAnchors').get();
var thirdId = anchorsArray[2].id;
</code></pre>
<p>get()方法十分有效，它能把jQuery对象集合转化成一个数组。</p>
<h2>9.用PHP检测Ajax请求</h2>
<p>事实是，在我们的大多数项目中不能依赖js来完成所有工作比如验证或者Ajax，假如js被禁用了怎么办呢？一个通用的解决办法是使用服务器端程序验证Ajax请求是否被发起。</p>
<p>jQuery使得这一做法变得很简单，可以通过$.ajax方法很方便地设置请求的头部。</p>
<pre><code>// 设置头部，这样接受请求的服务器端语言知道这是一个XMLHttpRequest
// Only send the header if it's not a remote XHR
if ( !remote ) {
	xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
}
</code></pre>
<p>设置了这个头部之后，我们可以用PHP（或者其他服务器编程语言）来检查这个头部，然后相应地做出反应。用PHP的话，可以通过$_SERVER['HTTP_X_REQUESTED_WITH']来判断。</p>
<pre><code>function isXhr() {
  return $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest';
}
</code></pre>
<h2>10.jQuery和$</h2>
<p>知道为什么jQuery和$可以互换么？看看jQuery的源码：</p>
<pre><code>window.jQuery = window.$ = jQuery;
</code></pre>
<p>由于jQuery本身运行在一个很大 的function中，这样做的好处是能最大程度地避免全局变量的出现。但也因为如此$在外面是undefined的，为了解决这个问题，把jQuery裸露给全局变量window，同时还给它一个别名$。</p>
<h2>11.根据条件载入jQuery</h2>
<p>我们都喜欢CDN，特别是Google的免费CDN，可是让我们不使用googleapi提供的CDN的一个阻挠就是大陆功夫墙的不可预知性。但是可以这么写，是<a href="http://html5boilerplate.com/" target="_blank">HTML5 Boilerplate</a>提供的方法：</p>
<pre><code>&lt;!-- Grab Google CDN jQuery. fall back to local if necessary --&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script&gt;!window.jQuery &amp;&amp; document.write('&lt;script src="js/jquery-1.4.2.min.js"&gt;&lt;\/script&gt;')&lt;/script&gt;
</code></pre>
<p>相当直观，如果window.jQuery是未定义的，那就是说下载js文件出了问题，这时候&amp;&amp;右边的句子就会为ture，所以就会插入一个本地版本的jQuery。Really brillant, isn’t it?</p>
<h2>12.jQuery Filters</h2>
<pre><code>&lt;scrip&gt;
	$('p:first').data('info', 'value'); // 填充 $的data对象，下文展示用 

	$.extend(
		jQuery.expr[":"], {
			block: function(elem) {
				return $(elem).css("display") === "block";
			},

			hasData : function(elem) {
				return !$.isEmptyObject( $(elem).data() );
			}
		}
	);

	$("p:hasData").text("has data"); // 可以获取所有有data属性的元素
	$("p:block").text("are block level"); // 获取所有拥有display:block属性的元素
&lt;/scrip&gt;
</code></pre>
<p>jQuery.expr[':']是jQuery.expr.filters的别名，上面的代码用$.extend扩展了jQuery的:也就是filter。</p>
<h2>13.单参数的hover方法</h2>
<p>在jQuery1.4之前，hover必须接受两个参数，分别显示in和out时候的handler function，而现在hover可以只接受一个参数了，每当产生mouseenter和mouseout事件的时候就会用这个function参数（一般是匿名的）来处理，如果处理得当的话，可以用一个function就完成两个function的效果，可以节省字符。</p>
<p>官方API<a href="http://api.jquery.com/hover/" target="_blank">http://api.jquery.com/hover/</a>上有很好的例子。</p>
<p><a href="http://api.jquery.com/hover/" target="_blank"></a></p>
<h2>14.属性对象作参数</h2>
<p>之前</p>
<pre><code>$('<a target="_blank">')
  .attr({
    id : 'someId',
    className : 'someClass',
    href : 'somePath.html'
  });
</a></code><a target="_blank"></a></pre>
<p><a target="_blank">现在</a></p>
<pre><a target="_blank"><code>$('</code></a><code>', {
    id : 'someId',
    className : 'someClass',
    href : 'somePath.html'
});
</code></pre>
<p>jQuery1.4以后，可以在新建DOM元素的时候给它传递一个（通常是匿名的）对象作为第二个参数，这样代码更加清晰简单，我们设置可以给这个对象里面传递一些jQuery特有的属性和事件，比如click和text。</p>
<p>原文地址：<a href="http://net.tutsplus.com/tutorials/javascript-ajax/14-helpful-jquery-tricks-notes-and-best-practices/" target="_blank">http://net.tutsplus.com/tutorials/javascript-ajax/14-helpful-jquery-tricks-notes-and-best-practices/</a></p>
<p>本文地址：<a href="http://yuguo.us/weblog/14-jquery-notes-2/">http://yuguo.us/weblog/14-jquery-notes-2/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2010/09/27/%e8%bd%ac14%e6%9d%a1%e5%85%b3%e4%ba%8ejquery%e7%9a%84%e7%9f%a5%e8%af%86/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery图片放大预览插件 cloud-zoom</title>
		<link>http://www.iinterest.net/2010/06/11/jquery-image-zoom-cloud-zoom/</link>
		<comments>http://www.iinterest.net/2010/06/11/jquery-image-zoom-cloud-zoom/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 08:27:03 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=877</guid>
		<description><![CDATA[table {
	
	border-collapse:collapse;
	border:1px solid #CCC;
	margin-bottom:20px;
}
td , th{
	padding:10px;
	vertical-align:top;	
	border:1px dotted #CCC;
}
th {
	background-color:#eee;	
}
td.noWrap {
	white-space:nowrap;	
} <a href="http://www.iinterest.net/2010/06/11/jquery-image-zoom-cloud-zoom/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iinterest.net/wp-content/uploads/2010/06/cloud-zoom.jpg"><img class="alignnone size-full wp-image-878" title="cloud-zoom" src="http://www.iinterest.net/wp-content/uploads/2010/06/cloud-zoom.jpg" alt="" width="514" height="257" /></a></p>
<p>分享一个jquery的图片放大预览插件:cloud-zoom.</p>
<p><a href="http://www.iinterest.net/demo/cloud-zoom.html" target="_blank"><strong>cloud-zoom DEMO</strong></a></p>
<p>部署步骤:</p>
<p>1.加载jquery-1.4.js 和 cloud-zoom.1.0.2.min.js</p>
<p>2.加入样式表(DEMO中&lt;style&gt;部分)</p>
<p>3.为需要放大预览效果的缩略图添加超链接<span style="color: #888888;">&lt;a&gt;</span>并将类命名为”cloud-zoom” <span style="color: #888888;">class=”cloud-zoom”</span></p>
<p>4.在超链接<span style="color: #888888;">&lt;a&gt;</span>的rel属性中加入需要的参数实现不同的效果<br />
<span id="more-877"></span><br />
实例:</p>
<blockquote><p>&lt;a href=”images/大图.jpg” class=”cloud-zoom” rel=”position:&#8217;inside&#8217; ,showTitle:false, adjustX:-2, adjustY:-2&#8243;&gt;&lt;img src=”images/缩略图.jpg” title=”iinterest” /&gt;&lt;/a&gt;</p></blockquote>
<p>cloud-zoom参数说明:</p>
<table border="1" cellpadding="2" width="100%">
<tbody>
<tr>
<th>Parameter</th>
<th>Description (from V1.0.0)</th>
<th>Default Value</th>
</tr>
<tr>
<td>zoomWidth</td>
<td>The width of the zoom window in pixels. If &#8216;auto&#8217; is specified, the width will be the same as the small image.</td>
<td class="noWrap">&#8216;auto&#8217;</td>
</tr>
<tr>
<td>zoomHeight</td>
<td>The height of the zoom window in pixels. If &#8216;auto&#8217; is specified, the height will be the same as the small image.</td>
<td><span class="noWrap">&#8216;auto&#8217;</span></td>
</tr>
<tr>
<td>position</td>
<td>Specifies the position of the zoom window relative to the small image. Allowable values are &#8216;left&#8217;, &#8216;right&#8217;, &#8216;top&#8217;, &#8216;bottom&#8217;, &#8216;inside&#8217; or you can specifiy the id of an html element to place the zoom window in e.g. position: &#8216;element1&#8242;</td>
<td>&#8216;right&#8217;</td>
</tr>
<tr>
<td>adjustX</td>
<td>Allows you to fine tune the x-position of the zoom window in pixels.</td>
<td>0</td>
</tr>
<tr>
<td>adjustY</td>
<td>Allows you to fine tune the y-position of the zoom window in pixels.</td>
<td>0</td>
</tr>
<tr>
<td>tint</td>
<td>Specifies a tint colour which will cover the small image. Colours should be specified in hex format, e.g. &#8216;#aa00aa&#8217;. Does not work with softFocus.</td>
<td>false</td>
</tr>
<tr>
<td>tintOpacity</td>
<td>Opacity of the tint, where 0 is fully transparent, and 1 is fully opaque.</td>
<td class="noWrap">0.5</td>
</tr>
<tr>
<td>lensOpacity</td>
<td>Opacity of the lens mouse pointer, where 0 is fully transparent, and 1 is fully opaque. In tint and soft-focus modes, it will always be transparent.</td>
<td>0.5</td>
</tr>
<tr>
<td>softFocus</td>
<td>Applies a subtle blur effect to the small image. Set to true or false. Does not work with tint.</td>
<td>false</td>
</tr>
<tr>
<td>smoothMove</td>
<td>Amount of smoothness/drift of the zoom image as it moves. The higher the number, the smoother/more drifty the movement will be. 1 = no smoothing.</td>
<td>3</td>
</tr>
<tr>
<td>showTitle</td>
<td>Shows the title tag of the image. True or false.</td>
<td>true</td>
</tr>
<tr>
<td>titleOpacity</td>
<td>Specifies the opacity of the title if displayed,  where 0 is fully transparent, and 1 is fully opaque.</td>
<td>0.5</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2010/06/11/jquery-image-zoom-cloud-zoom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery插件:实现类twitter的文本字数限制效果</title>
		<link>http://www.iinterest.net/2010/01/29/jquery-plugin-charcount/</link>
		<comments>http://www.iinterest.net/2010/01/29/jquery-plugin-charcount/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 07:59:49 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=723</guid>
		<description><![CDATA[之前也介绍过一个类似效果的JQ插件jQuery文本字数限制插件-maxlength,不过这次的charcount部署更简单,而且有超出数字提示的功能. 看看DEMO 简单的部署: 1.载入js: &#60;script type=”text/javascript” src=”http://www.iinterest.net/demo/js/jquery.js”&#62;&#60;/script&#62; &#60;script type=”text/javascript” src=”http://www.iinterest.net/demo/js/charCount.js”&#62;&#60;/script&#62; 2.Html结构: &#60;form id=”form” method=”post” action=”"&#62; &#60;h2&#62;Default Usage&#60;/h2&#62; &#60;div&#62; &#60;label for=”message”&#62;Type your message&#60;/label&#62; &#60;textarea id=”message1&#8243; name=”message1&#8243;&#62;&#60;/textarea&#62; &#60;/div&#62; &#60;h2&#62;Custom Usage&#60;/h2&#62; &#60;div&#62; &#60;label for=”message”&#62;Another message (limited to 30, warning at 10)&#60;/label&#62; &#60;textarea id=”message2&#8243; &#8230; <a href="http://www.iinterest.net/2010/01/29/jquery-plugin-charcount/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>之前也介绍过一个类似效果的JQ插件<a href="http://www.iinterest.net/2009/01/31/jquery-plugin-maxlength/">jQuery文本字数限制插件-maxlength</a>,不过这次的charcount部署更简单,而且有超出数字提示的功能.</p>
<p><strong><a href="http://www.iinterest.net/demo/charCount(twitter).html" target="_blank">看看DEMO</a></strong></p>
<p>简单的部署:</p>
<div>1.载入js:</div>
<blockquote>
<div id="_mcePaste">&lt;script type=”text/javascript” src=”http://www.iinterest.net/demo/js/jquery.js”&gt;&lt;/script&gt;</div>
<div id="_mcePaste">&lt;script type=”text/javascript” src=”http://www.iinterest.net/demo/js/charCount.js”&gt;&lt;/script&gt;</div>
</blockquote>
<p><!-- --></p>
<div>2.Html结构:</div>
<div>
<blockquote>
<div>&lt;form id=”form” method=”post” action=”"&gt;</div>
<div>&lt;h2&gt;Default Usage&lt;/h2&gt;</div>
<div>&lt;div&gt;</div>
<div>&lt;label for=”message”&gt;Type your message&lt;/label&gt;</div>
<div>&lt;textarea id=”message1&#8243; name=”message1&#8243;&gt;&lt;/textarea&gt;</div>
<div>&lt;/div&gt;</div>
<div>&lt;h2&gt;Custom Usage&lt;/h2&gt;</div>
<div>&lt;div&gt;</div>
<div>&lt;label for=”message”&gt;Another message (limited to 30, warning at 10)&lt;/label&gt;</div>
<div>&lt;textarea id=”message2&#8243; name=”message2&#8243;&gt;&lt;/textarea&gt;</div>
<div>&lt;/div&gt;</div>
<div>&lt;/form&gt;</div>
</blockquote>
</div>
<p><span id="more-723"></span></p>
<div>3.charCount插件设置:</div>
<div>
<blockquote>
<div>&lt;script type=”text/javascript”&gt;</div>
<div><span style="white-space: pre;"> </span>$(document).ready(function(){<span style="white-space: pre;"> </span></div>
<div><span style="white-space: pre;"> </span>//default usage</div>
<div><span style="white-space: pre;"> </span>$(“#message1&#8243;).charCount();</div>
<div><span style="white-space: pre;"> </span>//custom usage</div>
<div><span style="white-space: pre;"> </span>$(“#message2&#8243;).charCount({</div>
<div><span style="white-space: pre;"> </span>allowed: 30,<span style="white-space: pre;"> </span></div>
<div><span style="white-space: pre;"> </span>warning: 10,</div>
<div><span style="white-space: pre;"> </span>counterText: &#8216;剩余字数: &#8216;<span style="white-space: pre;"> </span></div>
<div><span style="white-space: pre;"> </span>});</div>
<div><span style="white-space: pre;"> </span>});</div>
<div>&lt;/script&gt;</div>
</blockquote>
</div>
<p>搞定:)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2010/01/29/jquery-plugin-charcount/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery in 15 minutes [快速入门]</title>
		<link>http://www.iinterest.net/2009/12/24/jquery-in-15-minutes/</link>
		<comments>http://www.iinterest.net/2009/12/24/jquery-in-15-minutes/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 02:12:03 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=642</guid>
		<description><![CDATA[jQuery in 15 minutes View more documents from simon.]]></description>
			<content:encoded><![CDATA[<div style="width:425px;text-align:left" id="__ss_88304"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/simon/jquery-in-15-minutes" title="jQuery in 15 minutes">jQuery in 15 minutes</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=jquery-in-15-minutes1421&#038;rel=0&#038;stripped_title=jquery-in-15-minutes" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=jquery-in-15-minutes1421&#038;rel=0&#038;stripped_title=jquery-in-15-minutes" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/simon">simon</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2009/12/24/jquery-in-15-minutes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2009 年度最佳 jQuery 插件</title>
		<link>http://www.iinterest.net/2009/12/14/2009-best-jquery-plug/</link>
		<comments>http://www.iinterest.net/2009/12/14/2009-best-jquery-plug/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 02:53:34 +0000</pubDate>
		<dc:creator>Bell</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.iinterest.net/?p=659</guid>
		<description><![CDATA[jQuery 是个宝库，而 jQuery 的插件体系是个取之不竭的宝库，众多开发者在 jQuery 框架下，设计了数不清的插件，jQuery  的特长是网页效果，因此，它的插件库也多与 UI 有关。本文是 webdesignledger.com 网站推选的2009年度最佳 jQuery 插件。 拉洋片 在一个固定区域，循环显示几段内容，这种方式很像旧时的拉洋片，2009年，这种 Web 效果大行其道，jQuery 有大量与此有关的插件，以下插件无疑是最佳的。 AnythingSlider 由 CSS-Tricks 的 Chris Coyier 设计，功能齐全，应用十分广泛。 Easy Slider 这个 Content Slider 插件既包含传统“前后”导航模式，又包含页码式导航。 Coda-Slider 2.0 Coda-Slider 2.0 是对 Panic Coda 网站上对应效果的模仿。 图片库 &#8230; <a href="http://www.iinterest.net/2009/12/14/2009-best-jquery-plug/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>jQuery 是个宝库，而 jQuery 的插件体系是个取之不竭的宝库，众多开发者在 jQuery 框架下，设计了数不清的插件，jQuery  的特长是网页效果，因此，它的插件库也多与 UI 有关。本文是 <a href="http://www.webdesignledger.com/">webdesignledger.com</a> 网站推选的2009年度最佳 jQuery 插件。</p>
<h3>拉洋片</h3>
<p>在一个固定区域，循环显示几段内容，这种方式很像旧时的拉洋片，2009年，这种 Web 效果大行其道，jQuery 有大量与此有关的插件，以下插件无疑是最佳的。</p>
<h3><a href="http://css-tricks.com/anythingslider-jquery-plugin/" target="_blank">AnythingSlider</a></h3>
<p><a href="http://css-tricks.com/anythingslider-jquery-plugin/" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_1.jpg" alt="jquery plugins" /></a><br />
<span id="more-659"></span><br />
由 CSS-Tricks 的 Chris Coyier 设计，功能齐全，应用十分广泛。</p>
<h3><a href="http://cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider" target="_blank">Easy Slider</a></h3>
<p><a href="http://cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_3.jpg" alt="jquery plugins" /></a></p>
<p>这个 Content Slider 插件既包含传统“前后”导航模式，又包含页码式导航。</p>
<h3><a href="http://www.ndoherty.biz/tag/coda-slider/" target="_blank">Coda-Slider 2.0</a></h3>
<p><a href="http://www.ndoherty.biz/tag/coda-slider/" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_7.jpg" alt="jquery plugins" /></a></p>
<p>Coda-Slider 2.0 是对 Panic Coda 网站上对应效果的模仿。</p>
<h3>图片库</h3>
<p>那些需要借助 Flash 实现滑动与渐入渐出效果图片库的日子已经去过，借助 jQuery，这种效果已经可以在本地实现，以下是本年度备受欢迎的几个 jQuery 图片库插件。</p>
<h3><a href="http://devkick.com/lab/galleria/" target="_blank">Galleria</a></h3>
<p><a href="http://devkick.com/lab/galleria/" target="_blank"><img src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_4.jpg" alt="jquery plugins" /></a></p>
<p>这是一个基于 jQuery 的图片库，可以逐个加载图片并显示缩略图。</p>
<h3><a href="http://www.catchmyfame.com/2009/08/13/jquery-panel-gallery-1-1-plugin-released/" target="_blank">jQuery Panel Gallery</a></h3>
<p><a href="http://www.catchmyfame.com/2009/08/13/jquery-panel-gallery-1-1-plugin-released/" target="_blank"><img src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_5.jpg" alt="jquery plugins" /></a></p>
<p>一个可以高度定义的图片库插件，无需对单个图片进行任何处理，这个插件会帮你完成一切。</p>
<h3><a href="http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html" target="_blank">slideViewer</a></h3>
<p><a href="http://www.gcmingati.net/wordpress/wp-content/lab/jquery/imagestrip/imageslide-plugin.html" target="_blank"><img src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_10.jpg" alt="jquery plugins" /></a></p>
<p>slideViewer 会检查你的图片列表中的编号，动态创建各个图片的页码浏览导航。</p>
<h3><a href="http://www.buildinternet.com/project/supersized/" target="_blank">Supersized</a></h3>
<p><a href="http://www.buildinternet.com/project/supersized/" target="_blank"><img src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_6.jpg" alt="jquery plugins" /></a></p>
<p>一个令人惊讶的图片循环展示插件，包含各种变换效果和预加载选项，会对图片自动改变尺寸以适应浏览器窗口。</p>
<h3>导航</h3>
<p>我们相信，作为网站的导航系统，应该越简单，越易用越好，然而，假如你确实希望实现一些更炫的效果，jQuery 就是最好的选项，以下插件是09年最好的 jQuery  导航插件。</p>
<h3><a href="http://pupunzi.open-lab.com/mb-jquery-components/mb-_menu/" target="_blank">jquery mb.menu</a></h3>
<p><a href="http://pupunzi.open-lab.com/mb-jquery-components/mb-_menu/" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_8.jpg" alt="jquery plugins" /></a></p>
<h3><a href="http://www.queness.com/post/256/horizontal-scroll-menu-with-jquery-tutorial" target="_blank">Horizontal Scroll Menu with jQuery </a></h3>
<p><a href="http://www.queness.com/post/256/horizontal-scroll-menu-with-jquery-tutorial" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_16.jpg" alt="jquery plugins" /></a></p>
<h3><a href="http://www.newmediacampaigns.com/page/autosprites-jquery-menu-plugin" target="_blank">AutoSprites</a></h3>
<p><a href="http://www.newmediacampaigns.com/page/autosprites-jquery-menu-plugin" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_9.jpg" alt="jquery plugins" /></a></p>
<h3>表单和表格</h3>
<p>在 Web 设计中，表单和表格都是不是很讨人喜欢的东西，但你不得不面对，本年度出现几个不错的 jQuery  插件帮你完成这些任务。</p>
<h3><a href="http://www.unwrongest.com/projects/password-strength/" target="_blank">Password Strength</a></h3>
<p><a href="http://www.unwrongest.com/projects/password-strength/" target="_blank"><img src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_12.jpg" alt="jquery plugins" /></a></p>
<p>这个插件帮你评估用户输入的密码是否足够强壮。</p>
<h3><a href="http://www.webdesignbeach.com/beachbar/ajax-fancy-captcha-jquery-plugin" target="_blank">Ajax Fancy Capcha</a></h3>
<p><a href="http://www.webdesignbeach.com/beachbar/ajax-fancy-captcha-jquery-plugin" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_13.jpg" alt="jquery plugins" /></a></p>
<p>顾名思义，一个支持 Ajax 又很炫的 jQuery Captcha 插件，它使用了很人性化的验证机制。</p>
<h3><a href="http://www.chromaloop.com/posts/chromatable-jquery-plugin" target="_blank">Chromatable</a></h3>
<p><a href="http://www.chromaloop.com/posts/chromatable-jquery-plugin" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/11/jquery_tables_10.jpg" alt="jquery tables" /></a></p>
<p>这个插件可以帮助你在表格上实现滚动条。</p>
<h3><a href="http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/" target="_blank">jqTransform</a></h3>
<p><a href="http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_14.jpg" alt="jquery plugins" /></a></p>
<p>一个式样插件，帮助你对表单中的控件进行式样控制。</p>
<h3><a href="http://www.uploadify.com/" target="_blank">Uploadify</a></h3>
<p><a href="http://www.uploadify.com/" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/12/jquery_2009_15.jpg" alt="jquery plugins" /></a></p>
<p>实现多个文件同时上传。</p>
<h3><a href="http://www.jankoatwarpspeed.com/post/2009/07/20/Expand-table-rows-with-jQuery-jExpand-plugin.aspx" target="_blank">jExpand </a></h3>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/07/20/Expand-table-rows-with-jQuery-jExpand-plugin.aspx" target="_blank"><img style="BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; BORDER-LEFT: #c0c0c0 1px solid; BORDER-BOTTOM: #c0c0c0 1px solid" src="http://webdesignledger.com/wp-content/uploads/2009/11/jquery_tables_1.jpg" alt="jquery tables" /></a></p>
<p>一个很轻量的 jQuery 插件，使你的表格可以扩展，在一些商业应用中，可以让表格更容易组织其中的内容。</p>
<p>本文来源：<a href="http://webdesignledger.com/resources/the-best-jquery-plugins-of-2009">http://webdesignledger.com/resources/the-best-jquery-plugins-of-2009</a><br />
中文翻译来源：<a href="http://www.iinterest.net/">COMSHARP CMS 企业网站内容管理系统官方站</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iinterest.net/2009/12/14/2009-best-jquery-plug/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

