<?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>I&#039;m qiqiboy !</title>
	<atom:link href="http://www.qiqiboy.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.qiqiboy.com</link>
	<description>一个very朝气的小孩子...</description>
	<lastBuildDate>Thu, 26 Apr 2012 01:42:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>TouchSliderBox 1.0 &#8211;容器宽度可变的幻灯</title>
		<link>http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html</link>
		<comments>http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comments</comments>
		<pubDate>Mon, 09 Apr 2012 10:23:24 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[touch]]></category>
		<category><![CDATA[幻灯]]></category>
		<category><![CDATA[触摸]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html</guid>
		<description><![CDATA[之前写过一个《TouchSlider 1.0 – 兼容触摸屏手机与PC的幻灯片》，那么这个TouchSliderBox和之前的TouchSlider有什么区别呢？ TouchSlider是支持幻灯宽度自适应的，也就是支持Responsive Layout（响应式布局）设计的页面上的slider。而TouchSliderBox其实也是支持响应式布局页面的，只不过每个幻灯的宽度是固定的，变化的是包围幻灯片的容器的宽度。其实差别就是TouchSlider你只能一次看到一张幻灯，而TouchSliderBox则随着幻灯容器宽度的不同，你可能同时可以看到多个幻灯片。 用一副图片来解释： 如上图，黄色线框即为幻灯容器。 为什么开发这个 这个主要是用来展示图片的，虽然TouchSlider也可以用来展示图片，但是由于每次只能显示一张图片，浪费了页面空间（在响应式布局中，从320到1920宽度都支持的话）。 还有一个原因就是模仿苹果的AppStore的页面下部的应用截图： 使用TouchSliderBox可以做到所有浏览器上保持样式统一，并且支持前后切换、鼠标滚动切换以及自适应页面宽度。 如何使用 使用方法，先载入前一篇文章中提到的那个TouchScroll脚本，然后再载入TouchSliderBox的脚本文件，然后可以通过调用TouchSliderBox这个函数来使用： 1: &#60;script type="text/javascript" src="http://qiqiboy.sinaapp.com/touchscroll/touchScroll.js"&#62;&#60;/script&#62; 2: &#60;script type="text/javascript" src="http://qiqiboy.sinaapp.com/sliderbox/touchSliderBox.dev.js"&#62;&#60;/script&#62; 3:&#160; 4: &#60;script type="text/javascript"&#62; 5: //第一个参数是幻灯所在容器的id，第二个参数为返回的幻灯实例的所附加的全局变量，可省略 6: TouchSliderBox('imgbox','t1'); 7: &#60;/script&#62; 为什么要载入TouchScroll呢？因为TouchSliderBox是基于TouchScroll开发的，也可以说是扩展了TouchScroll的一个插件，所以你需要预先载入TouchScroll。当然，你也可以只载入TouchSliderBox，然后会自动在页面中引入TouchScroll： 1: &#60;script type="text/javascript" src="http://qiqiboy.sinaapp.com/sliderbox/touchSliderBox.dev.js"&#62;&#60;/script&#62; 2:&#160; 3: &#60;script [...]]]></description>
			<content:encoded><![CDATA[<p>之前写过一个《<a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html">TouchSlider 1.0 – 兼容触摸屏手机与PC的幻灯片</a>》，那么这个TouchSliderBox和之前的TouchSlider有什么区别呢？</p>
<p>TouchSlider是支持幻灯宽度自适应的，也就是支持Responsive Layout（响应式布局）设计的页面上的slider。而TouchSliderBox其实也是支持响应式布局页面的，只不过每个幻灯的宽度是固定的，变化的是包围幻灯片的容器的宽度。其实差别就是TouchSlider你只能一次看到一张幻灯，而TouchSliderBox则随着幻灯容器宽度的不同，你可能同时可以看到多个幻灯片。</p>
<p>用一副图片来解释：<img title="slider" style="float: none; margin-left: auto; display: block; margin-right: auto" alt="slider" src="http://www.qiqiboy.com/wp-content/uploads/2012/04/slider.jpg" width="600" height="442"></p>
<p>如上图，黄色线框即为幻灯容器。</p>
<h3>为什么开发这个</h3>
<p>这个主要是用来展示图片的，虽然TouchSlider也可以用来展示图片，但是由于每次只能显示一张图片，浪费了页面空间（在响应式布局中，从320到1920宽度都支持的话）。</p>
<p>还有一个原因就是模仿苹果的AppStore的页面下部的应用截图：</p>
<p><img title="QQ截图20120409181449" style="display: inline" alt="QQ截图20120409181449" src="http://www.qiqiboy.com/wp-content/uploads/2012/04/QQ20120409181449.png" width="400" height="328">
<p>使用TouchSliderBox可以做到所有浏览器上保持样式统一，并且支持前后切换、鼠标滚动切换以及自适应页面宽度。</p>
<h3>如何使用</h3>
<p>使用方法，先载入前一篇文章中提到的那个TouchScroll脚本，然后再载入TouchSliderBox的脚本文件，然后可以通过调用TouchSliderBox这个函数来使用：</p>
<div id="codeSnippetWrapper" style="cursor: text; font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; width: 97.5%; border-bottom: silver 1px solid; overflow: auto; padding-bottom: 4px; direction: ltr; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; line-height: 12pt; padding-right: 4px; max-height: 200px; background-color: #f4f4f4">
<div id="codeSnippet" style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4">
<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum1" style="color: #606060">   1:</span> &lt;script type=<span style="color: #006080">"text/javascript"</span> src=<span style="color: #006080">"http://qiqiboy.sinaapp.com/touchscroll/touchScroll.js"</span>&gt;&lt;/script&gt;</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum2" style="color: #606060">   2:</span> &lt;script type=<span style="color: #006080">"text/javascript"</span> src=<span style="color: #006080">"http://qiqiboy.sinaapp.com/sliderbox/touchSliderBox.dev.js"</span>&gt;&lt;/script&gt;</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum3" style="color: #606060">   3:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum4" style="color: #606060">   4:</span> &lt;script type=<span style="color: #006080">"text/javascript"</span>&gt;</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum5" style="color: #606060">   5:</span> <span style="color: #008000">//第一个参数是幻灯所在容器的id，第二个参数为返回的幻灯实例的所附加的全局变量，可省略</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum6" style="color: #606060">   6:</span> TouchSliderBox(<span style="color: #006080">'imgbox'</span>,<span style="color: #006080">'t1'</span>);</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum7" style="color: #606060">   7:</span> &lt;/script&gt;</pre>
</div>
</div>
<p>为什么要载入TouchScroll呢？因为TouchSliderBox是基于TouchScroll开发的，也可以说是扩展了TouchScroll的一个插件，所以你需要预先载入TouchScroll。当然，你也可以只载入TouchSliderBox，然后会自动在页面中引入TouchScroll： </p>
<div id="codeSnippetWrapper" style="cursor: text; font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; width: 97.5%; border-bottom: silver 1px solid; overflow: auto; padding-bottom: 4px; direction: ltr; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; line-height: 12pt; padding-right: 4px; max-height: 200px; background-color: #f4f4f4">
<div id="codeSnippet" style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4">
<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum1" style="color: #606060">   1:</span> &lt;script type=<span style="color: #006080">"text/javascript"</span> src=<span style="color: #006080">"http://qiqiboy.sinaapp.com/sliderbox/touchSliderBox.dev.js"</span>&gt;&lt;/script&gt;</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum2" style="color: #606060">   2:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum3" style="color: #606060">   3:</span> &lt;script type=<span style="color: #006080">"text/javascript"</span>&gt;</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum4" style="color: #606060">   4:</span> <span style="color: #008000">//第一个参数是幻灯所在容器的id，第二个参数为返回的幻灯实例的所附加的全局变量，可省略</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum5" style="color: #606060">   5:</span> TouchSliderBox(<span style="color: #006080">'imgbox'</span>,<span style="color: #006080">'t1'</span>);</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum6" style="color: #606060">   6:</span> <span style="color: #008000">/*不引入TouchScroll，这样子也是可以工作的*/</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum7" style="color: #606060">   7:</span> &lt;/script&gt;</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum8" style="color: #606060">   8:</span>&nbsp; </pre>
</div>
</div>
<p>具体的效果以及使用可以参见我提供的 <a href="http://qiqiboy.sinaapp.com/sliderbox/" target="_blank"><strong>DEMO</strong></a> （可以用你的安卓或者苹果手机访问<a href="http://qiqiboy.sinaapp.com/sliderbox/">http://qiqiboy.sinaapp.com/sliderbox/</a> 体验。PC用户可以使用鼠标拖拽模拟触摸操作）。可以通过改变浏览器宽度或者横竖屏切换来查看幻灯的自适应效果。</p>
<p>JS的源码可以<a href="http://qiqiboy.sinaapp.com/myJS/touchSliderBox.dev.js" target="_blank">点此查看</a>。</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/04/touscroll.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案" class="thumb" /><a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html" title="TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案">TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案</a> (11)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/01/688860f891c5.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchSlider 1.0 - 兼容触摸屏手机与PC的幻灯片" class="thumb" /><a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html" title="TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片">TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片</a> (16)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 支持iphone、ipad 使用两根手指放大图片" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html" title="JavaScript: 支持iphone、ipad 使用两根手指放大图片">JavaScript: 支持iphone、ipad 使用两根手指放大图片</a> (20)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 让拖动支持iphone/ipad触摸" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html" title="JavaScript: 让拖动支持iphone/ipad触摸">JavaScript: 让拖动支持iphone/ipad触摸</a> (15)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/05/imgready.png&amp;h=100&amp;w=100&amp;zc=1" alt="javascript 图片预加载（远程获取图片尺寸）" class="thumb" /><a href="http://www.qiqiboy.com/2011/05/20/javascript-image-preload.html" title="javascript 图片预加载（远程获取图片尺寸）">javascript 图片预加载（远程获取图片尺寸）</a> (29)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/fn">http://qiqi.boy.im/fn<a></p><span style="background:#cc5566;color:#fffff;"><h4>Hi,welcome to leave your reply.</h4></span><h3>Related comments</h3><ul><li>2012年04月20日, <a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comment-18037">wmtimes</a> say: 现在都开始进军手机了哈。我还在原地经。唉。</li><li>2012年04月12日, <a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comment-17979">瘦腿精油</a> say: 移动平台是趋势啊</li><li>2012年04月10日, <a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comment-17971">博彩通</a> say: 嗯 不错  拿moto860试试</li><li>2012年04月10日, <a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comment-17966">qiqiboy</a> say: <a href="#comment-17932" rel="nofollow">@Veezy </a> 
 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_mad.gif' alt=':mad:' class='wp-smiley' />  多么优良的习惯，我长久坚持下来了</li><li>2012年04月10日, <a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comment-17965">qiqiboy</a> say: <a href="#comment-17957" rel="nofollow">@不能吧 </a> 
哈哈，这个其实是基于我上一篇文章里的TouchScroll的，所以还得载入那个脚本才行。不过总的代码量却是也不多，一共不到10K</li><li>2012年04月10日, <a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comment-17957">不能吧</a> say: 感觉代码量很少啊，不过我木有智能手机……</li><li>2012年04月10日, <a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comment-17937">Yafei</a> say: 手机测试了，效果很好。</li><li>2012年04月10日, <a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html#comment-17936">zwwooooo</a> say: 我深更半夜来竟然发现某人自沙！
你这个强大了，以后用得着直接CP好了。</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>TouchScroll 1.0 &#8211; 统一视觉样式的容器滚动解决方案</title>
		<link>http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html</link>
		<comments>http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comments</comments>
		<pubDate>Sun, 01 Apr 2012 08:20:40 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[触摸]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/?p=2860</guid>
		<description><![CDATA[大概三个月之前，我发布了一个JS组件，《 TouchSlider 1.0 – 兼容触摸屏手机与PC的幻灯片 》。后来陆续在项目中都有用到，觉自己得还是很方便的。 今天，我又带来了自己空余时间写的另一个组件，TouchScroll。它最大程度上模拟了ios上的默认UI组件的滚动条效果。 为什么开发这个东西 其实很大一部分原因是自己想通过写这么一个东西来更好地熟悉PC和触屏手机的JS开发方案中的差别和特点。当然还有一个原因当然就是有可能项目中会用到这个，例如，在多栏功能页面中。 在页面上，一个容器如果内容的尺寸超过容器的大小，会自动出现滚动条，这个滚动条在不同浏览器中时各有差别的（windows 8上的IE的滚动条的metro风更是颠覆了IE多年的滚动条样式），并且自定义样式性也各不相同（如IE和chrome的通过css改变滚动条的方法就很不一样）或不可定义。而且，在IOS4上，出现滚动条的容器是不可被手指滚动浏览的（IOS5上的safair已经没有这个问题了），你一拖动页面，总是整个网页被拖动了。 而TouchScroll正是解决这个问题的，并且它在所有PC和手机浏览器上提供了统一的滚动条样式。PC上支持鼠标拖动页面浏览或者拖动滚轮来滚动容器，手机上支持手指滑动滚动容器。它也支持自适应大小的容器（目前有一些类似插件则是渲染出不可改变大小的容器）。TouchScroll压缩后只有8K。 TouchScroll开发注意的问题 首先是用不用css3，TouchScroll我前后开发了两版，第一版在支持css3的浏览器上，容器的移动以及缓动效果均有css3提供，在IE上则有JS动画提供缓动效果。这个版本遇到了一个我无法解决的问题（因为要兼容IE，所以我没用translate，而是普通的绝对定位absolute，这样子遇到了滚动条动画中时的位置定位问题，没找到解决办法），关于css3的，后来又由于各种原因，这个版本放弃了，又重新开发了目前这个版本。这个版本里的缓动效果是由JS支持的。 还遇到一个快速移动后的缓动问题，需要取一定时间内的移动距离以及时间来计算加速度并从而计算出缓动的距离以及开始的速度。最后我是在拖动过程中（moveEvent）记录了每一次的时间与坐标，然后在拖动结束时（endEvent），取最后不大于200ms内的时间和距离，从而以此推算出需要缓动的距离和速度。大概过程如下： 1: var disc=[[/*时间*/],[/*坐标*/]]; //disc是用来保存时间与坐标的二维数组 2: var getMousePoint=function(){....} //获取鼠标坐标 3:&#160; 4: /* 每一次触发moveEvent时记录当前的时间与坐标 */ 5: moveEvent=function(){ 6: .... 7: disc.push(new Date()); 8: disc.push(getMousePoint()); 9: .... 10: [...]]]></description>
			<content:encoded><![CDATA[<p>大概三个月之前，我发布了一个JS组件，《 <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html"><strong>TouchSlider 1.0 – 兼容触摸屏手机与PC的幻灯片</strong></a> 》。后来陆续在项目中都有用到，觉自己得还是很方便的。</p>
<p>今天，我又带来了自己空余时间写的另一个组件，<strong>TouchScroll。</strong><font color="#ff0000">它最大程度上模拟了ios上的默认UI组件的滚动条效果。</font></p>
<h3>为什么开发这个东西</h3>
<p>其实很大一部分原因是自己想通过写这么一个东西来更好地熟悉PC和触屏手机的JS开发方案中的差别和特点。当然还有一个原因当然就是有可能项目中会用到这个，例如，在多栏功能页面中。</p>
<p>在页面上，一个容器如果内容的尺寸超过容器的大小，会自动出现滚动条，这个滚动条在不同浏览器中时各有差别的（windows 8上的IE的滚动条的metro风更是颠覆了IE多年的滚动条样式），并且自定义样式性也各不相同（如IE和chrome的通过css改变滚动条的方法就很不一样）或不可定义。而且，在IOS4上，出现滚动条的容器是不可被手指滚动浏览的（IOS5上的safair已经没有这个问题了），你一拖动页面，总是整个网页被拖动了。</p>
<p>而TouchScroll正是解决这个问题的，并且它在所有PC和手机浏览器上提供了统一的滚动条样式。PC上<strong><font color="#ff0000">支持鼠标拖动页面浏览或者拖动滚轮来滚动容器</font></strong>，手机上支持手指滑动滚动容器。它也支持自适应大小的容器（目前有一些类似插件则是渲染出不可改变大小的容器）。TouchScroll压缩后只有8K。</p>
<h3>TouchScroll开发注意的问题</h3>
<p>首先是用不用css3，TouchScroll我前后开发了两版，第一版在支持css3的浏览器上，容器的移动以及缓动效果均有css3提供，在IE上则有JS动画提供缓动效果。这个版本遇到了一个我无法解决的问题（因为要兼容IE，所以我没用translate，而是普通的绝对定位absolute，这样子遇到了滚动条动画中时的位置定位问题，没找到解决办法），关于css3的，后来又由于各种原因，这个版本放弃了，又重新开发了目前这个版本。这个版本里的缓动效果是由JS支持的。</p>
<p>还遇到一个快速移动后的缓动问题，需要取一定时间内的移动距离以及时间来计算加速度并从而计算出缓动的距离以及开始的速度。最后我是在拖动过程中（moveEvent）记录了每一次的时间与坐标，然后在拖动结束时（endEvent），取最后不大于200ms内的时间和距离，从而以此推算出需要缓动的距离和速度。大概过程如下： </p>
<div id="codeSnippetWrapper" style="cursor: text; font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; width: 97.5%; border-bottom: silver 1px solid; overflow: auto; padding-bottom: 4px; direction: ltr; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; line-height: 12pt; padding-right: 4px; max-height: 200px; background-color: #f4f4f4">
<div id="codeSnippet" style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4">
<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">var</span> disc=[[<span style="color: #008000">/*时间*/</span>],[<span style="color: #008000">/*坐标*/</span>]]; <span style="color: #008000">//disc是用来保存时间与坐标的二维数组</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum2" style="color: #606060">   2:</span> <span style="color: #0000ff">var</span> getMousePoint=<span style="color: #0000ff">function</span>(){....} <span style="color: #008000">//获取鼠标坐标</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum3" style="color: #606060">   3:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum4" style="color: #606060">   4:</span> <span style="color: #008000">/* 每一次触发moveEvent时记录当前的时间与坐标 */</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum5" style="color: #606060">   5:</span> moveEvent=<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum6" style="color: #606060">   6:</span>     ....</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum7" style="color: #606060">   7:</span>     disc.push(<span style="color: #0000ff">new</span> Date());</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum8" style="color: #606060">   8:</span>     disc.push(getMousePoint());</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum9" style="color: #606060">   9:</span>     ....</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum10" style="color: #606060">  10:</span> }</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum11" style="color: #606060">  11:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum12" style="color: #606060">  12:</span> endEvent=<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum13" style="color: #606060">  13:</span>     ....</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum14" style="color: #606060">  14:</span>     <span style="color: #008000">//计算出最近不超过200豪秒内数据</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum15" style="color: #606060">  15:</span>     <span style="color: #0000ff">var</span> nowTime=<span style="color: #0000ff">new</span> Date(),</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum16" style="color: #606060">  16:</span>         nowPos=getMousePoint();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum17" style="color: #606060">  17:</span>     <span style="color: #0000ff">while</span>(disc[0].length &amp;&amp; nowTime-disc[0][0]&gt;200){</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum18" style="color: #606060">  18:</span>         disc[0].shift();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum19" style="color: #606060">  19:</span>         disc[1].shift();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum20" style="color: #606060">  20:</span>     }</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum21" style="color: #606060">  21:</span>     <span style="color: #0000ff">if</span>(disc[0].length){</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum22" style="color: #606060">  22:</span>         time=nowTime-disc[0][0];<span style="color: #008000">//间隔时间</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum23" style="color: #606060">  23:</span>          offX=nowPos.x-disc[0][1].x;<span style="color: #008000">//横向间隔距离</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum24" style="color: #606060">  24:</span>           ...</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum25" style="color: #606060">  25:</span>     }</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum26" style="color: #606060">  26:</span>     ....</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum27" style="color: #606060">  27:</span> }</pre>
</div>
</div>
<h3>TouchScroll如何使用</h3>
<p>使用方法，载入TouchScroll的脚本文件，然后可以通过实例化“TouchScroll”这个类来使用。例如： </p>
<div id="codeSnippetWrapper" style="cursor: text; font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; width: 97.5%; border-bottom: silver 1px solid; overflow: auto; padding-bottom: 4px; direction: ltr; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; line-height: 12pt; padding-right: 4px; max-height: 200px; background-color: #f4f4f4">
<div id="codeSnippet" style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4">
<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">new</span> TouchScroll({</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum2" style="color: #606060">   2:</span>     <span style="color: #006080">'id'</span>: <span style="color: #006080">'slider'</span>,<span style="color: #008000">//要处理的容器的id</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum3" style="color: #606060">   3:</span>     <span style="color: #006080">'width'</span>:4,<span style="color: #008000">//滚动条宽度</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #006080">'minLength'</span>:20,<span style="color: #008000">//滚动条最小长度</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum5" style="color: #606060">   5:</span>     <span style="color: #006080">'opacity'</span>:0.8,<span style="color: #008000">//滚动条透明度</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum6" style="color: #606060">   6:</span>     <span style="color: #006080">'color'</span>:<span style="color: #006080">'black'</span>,<span style="color: #008000">//滚动条颜色</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum7" style="color: #606060">   7:</span> });</pre>
</div>
</div>
<h3>TouchScroll还存在的问题</h3>
<p>目前可能还存在一些bug，另外在滚动超出边界后的动画处理也不是很理想，过渡有点生硬。</p>
<p>目前TouchScroll也未提供一些操作接口，我会在日后慢慢完善，包括添加<strike>PC上的鼠标滚动支持</strike>(已添加)、更多自定义内容等。</p>
<p><strong>目前可以使用的接口:</strong></p>
<div id="codeSnippetWrapper" style="cursor: text; font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; width: 97.5%; border-bottom: silver 1px solid; overflow: auto; padding-bottom: 4px; direction: ltr; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; line-height: 12pt; padding-right: 4px; max-height: 200px; background-color: #f4f4f4">
<div id="codeSnippet" style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4">
<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">var</span> t1=<span style="color: #0000ff">new</span> TouchScroll();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum2" style="color: #606060">   2:</span> <span style="color: #008000">/*容器滚动接口</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum3" style="color: #606060">   3:</span> <span style="color: #008000"> *@param Number offx: 水平方向上滚动offx距离</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum4" style="color: #606060">   4:</span> <span style="color: #008000"> *@param Number offy: 垂直方向上滚动offy距离</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum5" style="color: #606060">   5:</span> <span style="color: #008000"> */</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum6" style="color: #606060">   6:</span> t1.scroll(offx,offy);</pre>
</div>
</div>
<p>查看<a href="http://qiqiboy.sinaapp.com/touchscroll/" target="_blank">DEMO</a><strong></strong>请点击<a href="http://qiqiboy.sinaapp.com/touchscroll/">http://qiqiboy.sinaapp.com/touchscroll/</a>。可以使用手机浏览器输入地址访问。</p>
<p>DEMO2: <a href="http://qiqiboy.sinaapp.com/touchscroll/scroll.html">http://qiqiboy.sinaapp.com/touchscroll/scroll.html</a></p>
<p>查看源代码<a href="http://qiqiboy.sinaapp.com/myJS/touchScroll.dev.js" target="_blank">请点此处</a>。</p>
<p><img title="touscroll" style="display: inline" alt="touscroll" src="http://www.qiqiboy.com/wp-content/uploads/2012/04/touscroll.png" width="520" height="262"></p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/04/QQ20120409181449.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯" class="thumb" /><a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html" title="TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯">TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯</a> (10)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 支持iphone、ipad 使用两根手指放大图片" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html" title="JavaScript: 支持iphone、ipad 使用两根手指放大图片">JavaScript: 支持iphone、ipad 使用两根手指放大图片</a> (20)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/01/688860f891c5.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchSlider 1.0 - 兼容触摸屏手机与PC的幻灯片" class="thumb" /><a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html" title="TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片">TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片</a> (16)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 让拖动支持iphone/ipad触摸" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html" title="JavaScript: 让拖动支持iphone/ipad触摸">JavaScript: 让拖动支持iphone/ipad触摸</a> (15)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/05/imgready.png&amp;h=100&amp;w=100&amp;zc=1" alt="javascript 图片预加载（远程获取图片尺寸）" class="thumb" /><a href="http://www.qiqiboy.com/2011/05/20/javascript-image-preload.html" title="javascript 图片预加载（远程获取图片尺寸）">javascript 图片预加载（远程获取图片尺寸）</a> (29)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/fk">http://qiqi.boy.im/fk<a></p><span style="background:#cc5566;color:#fffff;"><h4>Hi,welcome to leave your reply.</h4></span><h3>Related comments</h3><ul><li>2012年05月9日, <a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comment-18277">sprityaoyao</a> say: 是做移动开发的？</li><li>2012年05月2日, <a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comment-18148">RayRoad</a> say: 我用火狐移动和UC浏览器测试了一下 这两个浏览器对该组件不支持</li><li>2012年04月27日, <a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comment-18069">月月月</a> say: 大大大大大大</li><li>2012年04月25日, <a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comment-18058">宁波肛肠医院</a> say: 每天坚持更新博客还是很难得的，对于一些好的博文，
我一般都是收藏的，在这里就先谢谢这些博主的无私分享了。</li><li>2012年04月24日, <a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comment-18051">普歌</a> say: 好像没有很大区别，是不是我的浏览器有问题呢。</li><li>2012年04月22日, <a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comment-18042">黑涩的猪</a> say: 这不是广告
我有个VPS合租，不知博主愿不愿意参加
每人每年100RMB，4G硬盘，200G流量，1GHZ CPU，512M内存
如果有需要，联系 Q 826605134 注明VPS</li><li>2012年04月18日, <a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comment-18030">mopvhs</a> say: 我在这里看到了Apps for the iPad的页面模板~~<a href="http://www.dmxzone.com/demo/templates/ipad/index.html" rel="nofollow">点此查看Demo地址</a></li><li>2012年04月8日, <a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html#comment-17918">刘印博客</a> say: 算是有心的一个东西了，很多时候都觉得会自动有~</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>注意，有骗子。。。。。13790942055</title>
		<link>http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html</link>
		<comments>http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comments</comments>
		<pubDate>Fri, 23 Mar 2012 02:11:22 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[Myself-Life]]></category>
		<category><![CDATA[骗子]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html</guid>
		<description><![CDATA[昨晚接到一电话： 骗子：“XX，我到天津办事儿。你能猜到我是谁么？” 我：“额。。。你是A还是B？” 骗子：“嗯，对。”（我从这里开始以为对方就是B了） 我：“你不是在国外么，怎么突然回来了” 骗子：“。。。。。。。”骗子：“明天我去北京找你。”我：“好。” =========================== 第一部分结束============================ 第二天， 骗子：“XX，我这边办事儿钱不够了，先借我点钱行不？8K就行了” 我：“你的卡号发我？”（我很信任这个朋友，虽然我觉得以他的财力根本不可能去借钱） 骗子：“我没带卡，我发你我朋友的卡” 我此时才觉得对方肯定是个骗子，因为谁回国会他妈的忘记带银行卡！！！ 于是我登陆了gtalk，发现这位朋友在线。 我灵机一动，要骗子在gtalk上给我发个消息。 骗子：“你是不信任我是吧？” 我：“你用gtalk给我发个消息我就给你转钱” 骗子：“啥？”（骗子估计没听过gtalk，只会QQ）“你是不相信我是吧”（此时骗子提高了分贝数） 我gtalk问了下我朋友，他说他没回过，还在澳洲。所以这时可以确定被骗了。我：“我操你姑奶奶的二舅的妹的。。。。……%&#38;&#38;*&#38;*” 骗子：“。。。。嘟嘟嘟”（挂电话了） 。。。。。。。。 我此刻满脸黑线。。。。 =========================== 第二部分结束============================ 骗子骗术：事先得到你的手机号和你的名字，然后打电话给你，让你猜他的名字，在你说出了你朋友名字时，他顺势说你猜对了，他就是你说的那个人。然后并不急于立马向你要钱，他会说明天到你那里去找你。等到第二天，他会再给你打电弧找借口借钱。 骗子电话：13790942055 求骚扰，求组队攻击骗子啊！！！！大家可以去和骗子玩玩。。没准你还能从它那里骗来钱呢。。 Social Medias Connect（社交媒体连接） (467)Guestbook (369)插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX (190)围观wordpress中文圈内好玩的spam (133)【插件发布】WP Enjoy Reading(尽享阅读) (133)声明: [...]]]></description>
			<content:encoded><![CDATA[<p>昨晚接到一电话：</p>
<p>骗子：“XX，我到天津办事儿。你能猜到我是谁么？”</p>
<p>我：“额。。。你是A还是B？”</p>
<p>骗子：“嗯，对。”（我从这里开始以为对方就是B了）</p>
<p>我：“你不是在国外么，怎么突然回来了”</p>
<p>骗子：“。。。。。。。”<br />骗子：“明天我去北京找你。”<br />我：“好。”</p>
<p>=========================== 第一部分结束============================</p>
<p>第二天，</p>
<p>骗子：“XX，我这边办事儿钱不够了，先借我点钱行不？8K就行了”</p>
<p>我：“你的卡号发我？”（我很信任这个朋友，虽然我觉得以他的财力根本不可能去借钱）</p>
<p>骗子：“我没带卡，我发你我朋友的卡”</p>
<p>我此时才觉得对方肯定是个骗子，因为谁回国会他妈的忘记带银行卡！！！</p>
<p>于是我登陆了gtalk，发现这位朋友在线。</p>
<p>我灵机一动，要骗子在gtalk上给我发个消息。</p>
<p>骗子：“你是不信任我是吧？”</p>
<p>我：“你用gtalk给我发个消息我就给你转钱”</p>
<p>骗子：“啥？”（骗子估计没听过gtalk，只会QQ）<br />“你是不相信我是吧”（此时骗子提高了分贝数）</p>
<p>我gtalk问了下我朋友，他说他没回过，还在澳洲。所以这时可以确定被骗了。<br />我：“我操你姑奶奶的二舅的妹的。。。。……%&amp;&amp;*&amp;*”</p>
<p>骗子：“。。。。嘟嘟嘟”（挂电话了）</p>
<p>。。。。。。。。</p>
<p>我此刻满脸黑线。。。。</p>
<p>=========================== 第二部分结束============================</p>
<p>骗子骗术：事先得到你的手机号和你的名字，然后打电话给你，让你猜他的名字，在你说出了你朋友名字时，他顺势说你猜对了，他就是你说的那个人。然后并不急于立马向你要钱，他会说明天到你那里去找你。等到第二天，他会再给你打电弧找借口借钱。</p>
<p>骗子电话：<strong><font size="3">13790942055</font></strong></p>
<p>求骚扰，求组队攻击骗子啊！！！！大家可以去和骗子玩玩。。没准你还能从它那里骗来钱呢。。</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/05/61b11ad9jw1dgiip0xm7qj.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="Social Medias Connect（社交媒体连接）" class="thumb" /><a href="http://www.qiqiboy.com/products/plugins/social-medias-connect" title="Social Medias Connect（社交媒体连接）">Social Medias Connect（社交媒体连接）</a> (467)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/themes/windPaled/images/default-thumb.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="Guestbook" class="thumb" /><a href="http://www.qiqiboy.com/guestbook" title="Guestbook">Guestbook</a> (369)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/08/1de9fb000bac.png&amp;h=100&amp;w=100&amp;zc=1" alt="插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/20/wordpress-plugin-wp-rc-reply-ajax.html" title="插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX">插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX</a> (190)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/08/spam5.png&amp;h=100&amp;w=100&amp;zc=1" alt="围观wordpress中文圈内好玩的spam" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/31/chinese-circle-surrounding-wordpress-spam-fun.html" title="围观wordpress中文圈内好玩的spam">围观wordpress中文圈内好玩的spam</a> (133)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/8c442710e869_BD9F/wp-enjoy-reading.png&amp;h=100&amp;w=100&amp;zc=1" alt="【插件发布】WP Enjoy Reading(尽享阅读)" class="thumb" /><a href="http://www.qiqiboy.com/2010/10/10/wordpress-plugin-wp-enjoy-reading.html" title="【插件发布】WP Enjoy Reading(尽享阅读)">【插件发布】WP Enjoy Reading(尽享阅读)</a> (133)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/fi">http://qiqi.boy.im/fi<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年05月10日, <a href="http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comment-18282">神州数码电话</a> say: 骗子无处不在啊，我也遇到过这样的事</li><li>2012年04月30日, <a href="http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comment-18098">dsd</a> say: <a href='#comment-18078' rel="nofollow">@比木</a>
dtest</li><li>2012年04月27日, <a href="http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comment-18082">s7ooL</a> say: 我的一直到第四天他才跟我借钱呢。。。。。</li><li>2012年04月27日, <a href="http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comment-18078">比木</a> say: <a href="#comment-18060" rel="nofollow">@鲜活 </a> 
 移动公司什么的直接就贩卖号码的。</li><li>2012年04月26日, <a href="http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comment-18061">SHIEH</a> say: 也遇到过一次, 不过后来骗子被我耍了, 哈哈哈.</li><li>2012年04月26日, <a href="http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comment-18060">鲜活</a> say: 不知道那里泄露了个人信息了  太可怕了</li><li>2012年04月9日, <a href="http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comment-17929">刘印博客</a> say: 学到了，这是新招哟。 哈哈</li><li>2012年04月9日, <a href="http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html#comment-17927">岸边</a> say: 直接打一毛钱 对方付手续费，嘎嘎</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2012/03/23/there-is-a-cheater.html/feed</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片</title>
		<link>http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html</link>
		<comments>http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comments</comments>
		<pubDate>Wed, 11 Jan 2012 12:39:41 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[安卓]]></category>
		<category><![CDATA[幻灯]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/?p=2854</guid>
		<description><![CDATA[注：应该是不支持IE6的。支持安卓系、iOS苹果机、平板以及PC上的浏览器，包括IE7、IE8等。 触屏手机越来越流行，所以制作网站也要越来越多的考虑手机用户的使用体验。网站上如果有轮换图片的幻灯片（走马灯）之类的功能，就要考虑触屏手机用户的使用体验，而提供他们可以通过手指滑动来切换上一张/下一张的功能，将会是很大的体验提升。 基于此考虑，我在参考了Swipe的实现后，开发了可以同时支持触屏手机手指滑动与PC上鼠标点击滑动的一段脚本，命名为“TouchSlider”。(已经有叫这个名字的脚本了？俺NO Care ^_^)。 为什么开发这个东西 上面已经说了，是为了支持触屏手机。其实还有一个更重要的原因是，为了适应手机版网站的自适应宽度特性。 由于手机、平板终端的多样性，其手机屏的分辨率各不相同，而许多网站为了适应多种设备的显示，往往是使用了自适应宽度的设计，也就是说页面宽度会随着所使用的设备的分辨率不同而有所变化，旋转设备方向后网站宽度也会变化。 之前的许多幻灯脚本只支持固定高宽的幻灯显示，所以在手机上并不能很好的工作。 这个TouchSlider的特点 也没什么特别的，主要是以下几点： 无JS库依赖，使用原生javascript开发。手机端我个人并不建议载入太多JS，能少一个请求少一个。尤其是如果为了一个很小的功能而去载入一个jQuery或者prototype之类的库，有点太不划算了。TouchSlider整个脚本大小约12KB，压缩后只有6KB。 触摸滑动与点击拖动切换全支持支持触屏手机上的触摸滑动切换，也支持PC上的点击拖动切换。详细可以参见DEMO页面，并实际使用体验。用触屏手机的可以用手指滑动切换，电脑端的用户可以用鼠标点击拖动切换。 幻灯支持多个方向切换支持向左、向右以及向上和向下滑动切换。 支持自适应浏览器宽度手机横竖屏切换或者改变浏览器宽度时，全宽度幻灯依然能正常工作适应 TouchSlider的使用以及demo 使用方法，载入TouchSlider的脚本文件，然后可以通过实例化“TouchSlider”这个类来使用。例如： 1: new TouchSlider({ 2: 'id': 'slider', //幻灯容器的id 3: 'auto': 0, //是否自动开始，负数表示非自动开始，0,1,2,3....表示自动开始以及从第几个开始 4: 'speed':600, //动画效果持续时间 ms 5: 'timeout':5000,//幻灯切换的间隔时间 ms 6: 'className':'', //每个幻灯所在的li标签的classname, 7: 'direction':'left', [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>注：应该是不支持IE6的。支持安卓系、iOS苹果机、平板以及PC上的浏览器，包括IE7、IE8等。</p>
</blockquote>
<p><img title="捕获" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; float: none; padding-top: 0px; padding-left: 0px; margin-left: auto; display: block; padding-right: 0px; border-top-width: 0px; margin-right: auto" border="0" alt="捕获" src="http://www.qiqiboy.com/wp-content/uploads/2012/01/688860f891c5.png" width="550" height="422">触屏手机越来越流行，所以制作网站也要越来越多的考虑手机用户的使用体验。网站上如果有轮换图片的幻灯片（走马灯）之类的功能，就要考虑触屏手机用户的使用体验，而提供他们可以通过手指滑动来切换上一张/下一张的功能，将会是很大的体验提升。</p>
<p>基于此考虑，我在参考了<a href="http://swipejs.com/" target="_blank">Swipe</a>的实现后，开发了可以同时支持触屏手机手指滑动与PC上鼠标点击滑动的一段脚本，命名为“TouchSlider”。(已经有叫这个名字的脚本了？俺NO Care ^_^)。</p>
<h3>为什么开发这个东西</h3>
<p>上面已经说了，是为了支持触屏手机。其实还有一个更重要的原因是，为了适应手机版网站的自适应宽度特性。</p>
<p>由于手机、平板终端的多样性，其手机屏的分辨率各不相同，而许多网站为了适应多种设备的显示，往往是使用了自适应宽度的设计，也就是说页面宽度会随着所使用的设备的分辨率不同而有所变化，旋转设备方向后网站宽度也会变化。</p>
<p>之前的许多幻灯脚本只支持固定高宽的幻灯显示，所以在手机上并不能很好的工作。</p>
<h3>这个TouchSlider的特点</h3>
<p>也没什么特别的，主要是以下几点：</p>
<ol>
<li><strong>无JS库依赖，使用原生javascript开发。</strong><br />手机端我个人并不建议载入太多JS，能少一个请求少一个。尤其是如果为了一个很小的功能而去载入一个jQuery或者prototype之类的库，有点太不划算了。TouchSlider整个脚本大小约12KB，压缩后只有6KB。
<li><strong>触摸滑动与点击拖动切换全支持<br /></strong>支持触屏手机上的触摸滑动切换，也支持PC上的点击拖动切换。详细可以参见DEMO页面，并实际使用体验。用触屏手机的可以用手指滑动切换，电脑端的用户可以用鼠标点击拖动切换。
<li><strong>幻灯支持多个方向切换<br /></strong>支持向左、向右以及向上和向下滑动切换。
<li><strong>支持自适应浏览器宽度<br /></strong>手机横竖屏切换或者改变浏览器宽度时，全宽度幻灯依然能正常工作适应 </li>
</ol>
<h3>TouchSlider的使用以及demo</h3>
<p>使用方法，载入TouchSlider的脚本文件，然后可以通过实例化“TouchSlider”这个类来使用。例如：</p>
<div id="codeSnippetWrapper" style="cursor: text; font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; width: 97.5%; border-bottom: silver 1px solid; overflow: auto; padding-bottom: 4px; direction: ltr; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; line-height: 12pt; padding-right: 4px; max-height: 200px; background-color: #f4f4f4">
<div id="codeSnippet" style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4">
<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">new</span> TouchSlider({</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum2" style="color: #606060">   2:</span>     <span style="color: #006080">'id'</span>: <span style="color: #006080">'slider'</span>, <span style="color: #008000">//幻灯容器的id</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum3" style="color: #606060">   3:</span>     <span style="color: #006080">'auto'</span>: 0, <span style="color: #008000">//是否自动开始，负数表示非自动开始，0,1,2,3....表示自动开始以及从第几个开始</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #006080">'speed'</span>:600, <span style="color: #008000">//动画效果持续时间 ms</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum5" style="color: #606060">   5:</span>     <span style="color: #006080">'timeout'</span>:5000,<span style="color: #008000">//幻灯切换的间隔时间 ms</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum6" style="color: #606060">   6:</span>     <span style="color: #006080">'className'</span>:<span style="color: #006080">''</span>, <span style="color: #008000">//每个幻灯所在的li标签的classname,</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum7" style="color: #606060">   7:</span>     <span style="color: #006080">'direction'</span>:<span style="color: #006080">'left'</span>, <span style="color: #008000">//left right up down</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum8" style="color: #606060">   8:</span>     <span style="color: #006080">'mouseWheel'</span>:<span style="color: #0000ff">false</span>,<span style="color: #008000">//是否支持鼠标滚轮</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum9" style="color: #606060">   9:</span>     <span style="color: #006080">'before'</span>:<span style="color: #0000ff">new</span> Function(),<span style="color: #008000">//幻灯切换前的回调</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum10" style="color: #606060">  10:</span>     <span style="color: #006080">'after'</span>:<span style="color: #0000ff">new</span> Function() <span style="color: #008000">//幻灯切换后的回调</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum11" style="color: #606060">  11:</span> });</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum12" style="color: #606060">  12:</span>&nbsp; </pre>
</div>
</div>
<p>这样子幻灯就会工作了。</p>
<p>当然，为了方便用户通过点击“上一张”/“下一张”来切换，实例化后的这个对象也具有一些方法来很方便的进行操作：</p>
<div id="codeSnippetWrapper" style="cursor: text; font-size: 8pt; border-top: silver 1px solid; font-family: 'Courier New', courier, monospace; border-right: silver 1px solid; width: 97.5%; border-bottom: silver 1px solid; overflow: auto; padding-bottom: 4px; direction: ltr; text-align: left; padding-top: 4px; padding-left: 4px; margin: 20px 0px 10px; border-left: silver 1px solid; line-height: 12pt; padding-right: 4px; max-height: 200px; background-color: #f4f4f4">
<div id="codeSnippet" style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4">
<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">var</span> slider=<span style="color: #0000ff">new</span> TouchSlider({id:<span style="color: #006080">'slider'</span>});</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum2" style="color: #606060">   2:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum3" style="color: #606060">   3:</span> <span style="color: #008000">//切换上一张</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum4" style="color: #606060">   4:</span> slider.prev();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum5" style="color: #606060">   5:</span>  </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum6" style="color: #606060">   6:</span> <span style="color: #008000">//切换下一张</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum7" style="color: #606060">   7:</span> slider.next();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum8" style="color: #606060">   8:</span>  </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum9" style="color: #606060">   9:</span> <span style="color: #008000">//向前或者向后切换N张，例如，向前切换2张，可以通过 slider.prev(2) 来实现</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum10" style="color: #606060">  10:</span> sldier.prev(num);</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum11" style="color: #606060">  11:</span> slider.next(num);</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum12" style="color: #606060">  12:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum13" style="color: #606060">  13:</span> <span style="color: #008000">//暂停幻灯播放</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum14" style="color: #606060">  14:</span> slider.pause();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum15" style="color: #606060">  15:</span>  </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum16" style="color: #606060">  16:</span> <span style="color: #008000">//开始播放</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum17" style="color: #606060">  17:</span> slider.begin();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum18" style="color: #606060">  18:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum19" style="color: #606060">  19:</span> <span style="color: #008000">//停止播放</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum20" style="color: #606060">  20:</span> slider.stop();</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum21" style="color: #606060">  21:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum22" style="color: #606060">  22:</span> <span style="color: #008000">//播放第N张幻灯片。N等于0,1,2...幻灯片数量</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum23" style="color: #606060">  23:</span> sldier.slide(N)</pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum24" style="color: #606060">  24:</span>&nbsp; </pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum25" style="color: #606060">  25:</span> <span style="color: #008000">//TouchSlider对象具有的其他属性</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum26" style="color: #606060">  26:</span> slider.index <span style="color: #008000">//当前显示的幻灯的次序</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum27" style="color: #606060">  27:</span> slider.length <span style="color: #008000">//幻灯片数量</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum28" style="color: #606060">  28:</span> slider.width, slider.height <span style="color: #008000">//幻灯当前的宽度 高度（可能会随着浏览器尺寸变化而变化）</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: white"><span id="lnum29" style="color: #606060">  29:</span> slider.status <span style="color: #008000">//幻灯的状态。0表示停止，1表示正在播放，2表示暂停。-1表示脚本出错。如果出错，slider.errorInfo提供了出错信息</span></pre>

<pre style="border-top-style: none; font-size: 8pt; font-family: 'Courier New', courier, monospace; width: 100%; border-bottom-style: none; color: black; overflow: visible; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; border-left-style: none; line-height: 12pt; padding-right: 0px; background-color: #f4f4f4"><span id="lnum30" style="color: #606060">  30:</span>&nbsp; </pre>
</div>
</div>
<p>具体的效果以及使用可以参见我提供的 <a href="http://qiqiboy.sinaapp.com/touchslider/" target="_blank"><strong>DEMO</strong></a> （可以用你的安卓或者苹果手机访问<a href="http://qiqiboy.sinaapp.com/touchslider/">http://qiqiboy.sinaapp.com/touchslider/</a> 体验。PC用户可以使用鼠标拖拽模拟触摸操作）。可以通过改变浏览器宽度或者横竖屏切换来查看幻灯的自适应效果。</p>
<p>源码下载点击<a href="http://qiqiboy.sinaapp.com/myJS/touchslider.dev.js" target="_blank">此处下载</a>。</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 支持iphone、ipad 使用两根手指放大图片" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html" title="JavaScript: 支持iphone、ipad 使用两根手指放大图片">JavaScript: 支持iphone、ipad 使用两根手指放大图片</a> (20)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/01/Pompidou_ZH-CN3304850761.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="终极完美版javascript获取并限制调整图片尺寸" class="thumb" /><a href="http://www.qiqiboy.com/2011/01/30/javascript-and-limit-access-to-adjust-the-picture-size.html" title="终极完美版javascript获取并限制调整图片尺寸">终极完美版javascript获取并限制调整图片尺寸</a> (44)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/04/QQ20120409181449.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯" class="thumb" /><a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html" title="TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯">TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯</a> (10)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/06/5.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress的微博时间显示方法" class="thumb" /><a href="http://www.qiqiboy.com/2011/06/10/sina-weibo-timestamp-function-2.html" title="wordpress的微博时间显示方法">wordpress的微博时间显示方法</a> (19)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/05/imgready.png&amp;h=100&amp;w=100&amp;zc=1" alt="javascript 图片预加载（远程获取图片尺寸）" class="thumb" /><a href="http://www.qiqiboy.com/2011/05/20/javascript-image-preload.html" title="javascript 图片预加载（远程获取图片尺寸）">javascript 图片预加载（远程获取图片尺寸）</a> (29)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/fg">http://qiqi.boy.im/fg<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年04月19日, <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comment-18033">Carrie</a> say: 源碼下載的鏈結按下去是杯具的 404 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_mad.gif' alt=':mad:' class='wp-smiley' /> </li><li>2012年04月9日, <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comment-17928">TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯 - I&#039;m qiqiboy !</a> say: [...] 之前写过一个《TouchSlider 1.0 – 兼容触摸屏手机与PC的幻灯片》，那么这个TouchSliderBox和之前的TouchSlider有什么区别呢？ [...]</li><li>2012年04月1日, <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comment-17841">leilei</a> say: 嘻嘻，我又来顶一下。 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_cool.gif' alt=':cool:' class='wp-smiley' /> </li><li>2012年04月1日, <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comment-17839">TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案 - I&#039;m qiqiboy !</a> say: [...] TouchSlider 1.0 – 兼容触摸屏手机与PC的幻灯片 [...]</li><li>2012年03月17日, <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comment-17578">苏州婚纱摄影</a> say: 看起来是不错，就是不知道自己能不能搞的定啊！我的站：

http://www.zhenshi99.com，有时间帮踩下，感激不尽了！</li><li>2012年03月14日, <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comment-17546">青浦房产</a> say: 幻灯片知道 但代码就看不懂了</li><li>2012年03月13日, <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comment-17533">爱音族</a> say: 很给力啊！</li><li>2012年03月10日, <a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html#comment-17430">www.hioils.com</a> say: 嗯。效果不错。一回来就出新作品了。支持。</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>qiqiboy归来 &#8211; 纯吐槽</title>
		<link>http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html</link>
		<comments>http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comments</comments>
		<pubDate>Sun, 08 Jan 2012 04:50:58 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[Myself-Life]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[吐槽]]></category>
		<category><![CDATA[工作]]></category>
		<category><![CDATA[生活]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html</guid>
		<description><![CDATA[博客很久没更新了，上次更新还是去年的9月16日了。算来已经快三个月了。当然，从没想过要把博客停掉，只是期间太多杂事，也没有折腾什么可分享的技术文。 还是从最近来说。 订购火车票 今天早上一早7点半多我爬起来，打开12306.cn来定火车票，战战兢兢地连续登陆了几十遍后终于在八点15分时登陆了上去。然后是订票，依然是提交了无数遍后网站依然淡定的显示着“系统忙。。。”。我眼睁睁的看着卧铺票数量从“有”变成“10”最后成为“无”。最后三十分钟后，又一次提交订单时，终于看到了“有未完成订单”的提示。遂迅速付款完成车票购买。当然，只是硬座了。 我已经问候了铁道部全家数遍。 网站宕机风波 1月5号之前的两周，我的博客访问的话会一直是“域名已被阻断”的提示。最初以为是暂时的，后来发现一个多星期了还是这个提示。于是我询问了万网（域名在万网）工作人员，答曰“域名正常解析，与他们无关”。于是联系了我的主机提供商，确认是机房屏蔽的，说是前段时间的数据库大面积泄露导致上头对未备案网站的监察收紧，他们临时屏蔽了未备案网站。我的域名是备过案的，所以我在提交了备案号后网站立马就解封了。 重见天日了。 蜗居在帝都 正因为身在帝都苟活，所以才有了开头的订购火车票回家的需求。 当然，求被请客，求腐败的需求也很旺盛。↖(^ω^)↗ 博客未来 博客继续更新，内容依然是与javascript、wordpress等技术文为主。 相信有不少之前的博客主都已经陆续离开这个圈子了，当然也有不少新人加入。有意与小站友链的，欢迎留言板申请。 感谢各位支持。 旅行在云南 (37)最近口腔溃疡+牙龈疼 (4)Social Medias Connect（社交媒体连接） (467)Guestbook (369)插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX (190)声明: 本站遵循 署名-非商业性使用-相同方式共享 3.0 共享协议. 转载请注明转自 I'm qiqiboy ! 本文地址: http://qiqi.boy.im/fdLook, this post is replyed [...]]]></description>
			<content:encoded><![CDATA[<p>博客很久没更新了，上次更新还是去年的9月16日了。算来已经快三个月了。当然，从没想过要把博客停掉，只是期间太多杂事，也没有折腾什么可分享的技术文。</p>
<p>还是从最近来说。</p>
<h3>订购火车票</h3>
<p><img class="aligncenter size-full wp-image-2853" title="61b11ad9tw1douqptegsnj" alt="" src="http://www.qiqiboy.com/wp-content/uploads/2012/01/61b11ad9tw1douqptegsnj.jpg" width="955" height="416">今天早上一早7点半多我爬起来，打开12306.cn来定火车票，战战兢兢地连续登陆了几十遍后终于在八点15分时登陆了上去。然后是订票，依然是提交了无数遍后网站依然淡定的显示着“系统忙。。。”。我眼睁睁的看着卧铺票数量从“有”变成“10”最后成为“无”。最后三十分钟后，又一次提交订单时，终于看到了“有未完成订单”的提示。遂迅速付款完成车票购买。当然，只是硬座了。</p>
<p>我已经问候了铁道部全家数遍。</p>
<h3>网站宕机风波</h3>
<p>1月5号之前的两周，我的博客访问的话会一直是“域名已被阻断”的提示。最初以为是暂时的，后来发现一个多星期了还是这个提示。于是我询问了万网（域名在万网）工作人员，答曰“域名正常解析，与他们无关”。于是联系了我的主机提供商，确认是机房屏蔽的，说是前段时间的数据库大面积泄露导致上头对未备案网站的监察收紧，他们临时屏蔽了未备案网站。我的域名是备过案的，所以我在提交了备案号后网站立马就解封了。</p>
<p>重见天日了。</p>
<h3>蜗居在帝都</h3>
<p>正因为身在帝都苟活，所以才有了开头的订购火车票回家的需求。</p>
<p>当然，求被请客，求腐败的需求也很旺盛。↖(^ω^)↗</p>
<h3>博客未来</h3>
<p>博客继续更新，内容依然是与javascript、wordpress等技术文为主。</p>
<p>相信有不少之前的博客主都已经陆续离开这个圈子了，当然也有不少新人加入。有意与小站友链的，欢迎留言板申请。</p>
<p>感谢各位支持。</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/05/200808311631407821.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="旅行在云南" class="thumb" /><a href="http://www.qiqiboy.com/2011/05/27/i-am-traveling-in-yun-nan.html" title="旅行在云南">旅行在云南</a> (37)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2009/10/20091023002_thumb.gif&amp;h=100&amp;w=100&amp;zc=1" alt="最近口腔溃疡+牙龈疼" class="thumb" /><a href="http://www.qiqiboy.com/2009/10/23/nothing-the-life.html" title="最近口腔溃疡+牙龈疼">最近口腔溃疡+牙龈疼</a> (4)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/05/61b11ad9jw1dgiip0xm7qj.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="Social Medias Connect（社交媒体连接）" class="thumb" /><a href="http://www.qiqiboy.com/products/plugins/social-medias-connect" title="Social Medias Connect（社交媒体连接）">Social Medias Connect（社交媒体连接）</a> (467)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/themes/windPaled/images/default-thumb.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="Guestbook" class="thumb" /><a href="http://www.qiqiboy.com/guestbook" title="Guestbook">Guestbook</a> (369)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/08/1de9fb000bac.png&amp;h=100&amp;w=100&amp;zc=1" alt="插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/20/wordpress-plugin-wp-rc-reply-ajax.html" title="插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX">插件发布：边栏最新评论及ajax回复——WP RC Reply AJAX</a> (190)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/fd">http://qiqi.boy.im/fd<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年04月4日, <a href="http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comment-17865">LL.CX</a> say: 买票变得鸡巴容易了啊 ，直接付款 就行</li><li>2012年03月10日, <a href="http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comment-17431">www.hioils.com</a> say: 期待你的新文章</li><li>2012年02月9日, <a href="http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comment-17140">爱蝌蚪</a> say: 期待你的新文章</li><li>2012年02月8日, <a href="http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comment-17133">刘学政博客</a> say: 老兄终于回来了，以后要加强更新啊</li><li>2012年01月16日, <a href="http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comment-16934">掌柜的马甲</a> say: 欢迎回来~网上买票买的早,没有遇到啥麻烦</li><li>2012年01月15日, <a href="http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comment-16924">超人</a> say: 乍一看以为是船票~~没想到是帝都出来的火车票。哈哈。今年不用再为购票而烦恼了 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_twisted.gif' alt=':twisted:' class='wp-smiley' /> </li><li>2012年01月13日, <a href="http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comment-16891">康康</a> say: 春节不回家，离家近感受不到买票的热闹氛围确实是一大憾事。</li><li>2012年01月12日, <a href="http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html#comment-16882">jixiangac</a> say: 网上有个利用FIREBUG购票攻略的，很牛的</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2012/01/08/qiqiboy-coming-again.html/feed</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>社交媒体连接 V1.6更新 支持facebook 完全重写的注册流程</title>
		<link>http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html</link>
		<comments>http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comments</comments>
		<pubDate>Fri, 16 Sep 2011 07:14:09 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[plugin]]></category>
		<category><![CDATA[SocialMedias]]></category>
		<category><![CDATA[微博]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[更新]]></category>
		<category><![CDATA[社交媒体连接]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html</guid>
		<description><![CDATA[这几天抽空对我的插件 社交媒体连接 进行了更新，一连更新了三个版本，新增的特性如下： 增加对facebook的支持 使用了V1.6的同学应该已经在后台看到facebook的连接登陆图标。需要说明的是，管理员在启用facebook连接注册前，自己一定要到后台的 “绑定微博同步文章” 页面， 点击facebook的登陆连接，在弹出的要求输入facebook appid窗口中，填写为你网站申请的appid和appsecret。（不知道如何申请，那还是不要用facebook了） 设置完成后，你的网站用户才可以在前台使用facebook连接功能。 如果要修改输入的appid和appsecret。可以点击facebook连接按钮右边的“修改appKey”按钮，进行修改操作。 完全重写的账户注册流程 这是V1.6重点功能。原先的账号注册流程是： 用户点击微博连接 –》 带入到微博授权页面 –》 授权后返回网站 –》 获得授权的用户信息 –》 使用这些信息自动为用户建立账号 上面的缺点是，整个过程是自动的，用户没有选择用户名、邮箱的权利。尤其是邮箱，由于权限限制，即使授权后也无法获得用户的真实邮箱，所以使用虚拟的邮箱为用户注册后，用户也无法即时从网站得到信息（如评论回复信息）。 新的注册流程，在最后一步，将用户带到一个全新的注册页面，让他输入自己的真实可用的邮箱，这样一来就避免了上面的不足。并且如果用户愿意，他还可以自行更换一个用户名，并修改自己的网站地址（默认是用户的微博地址）。 最重要的是，使用新的注册流程后，旧的注册用户完全不受影响。 欢迎大家去更新最新版。wordpress官方下载地址 &#160; 有任何问题可以在新浪微博：http://weibo.com/qiqiboy 或者我博客任意页面留言交流。 Social Medias Connect V1.3发布 新增图片同步 (25)WordPress插件发布: Social Medias Connect (84)有关社交媒体连接插件对饭否、follow5支持的说明 (32)Social [...]]]></description>
			<content:encoded><![CDATA[<p>这几天抽空对我的插件 <a href="http://www.qiqiboy.com/products/plugins/social-medias-connect" target="_blank"><strong>社交媒体连接</strong></a> 进行了更新，一连更新了三个版本，新增的特性如下：</p>
<h3>增加对facebook的支持</h3>
<p>使用了V1.6的同学应该已经在后台看到facebook的连接登陆图标。需要说明的是，管理员在启用facebook连接注册前，自己一定要到后台的 “绑定微博同步文章” 页面， 点击facebook的登陆连接，在弹出的要求输入facebook appid窗口中，填写为你网站申请的appid和appsecret。（不知道如何申请，那还是不要用facebook了）<img style="display: block; float: none; margin-left: auto; margin-right: auto" title="fb1" alt="fb1" src="http://www.qiqiboy.com/wp-content/uploads/2011/09/fb1.png" width="397" height="376" /></p>
<p>设置完成后，你的网站用户才可以在前台使用facebook连接功能。</p>
<p>如果要修改输入的appid和appsecret。可以点击facebook连接按钮右边的“修改appKey”按钮，进行修改操作。</p>
<h3>完全重写的账户注册流程</h3>
<p>这是V1.6重点功能。原先的账号注册流程是：</p>
<blockquote><p>用户点击微博连接 –》 带入到微博授权页面 –》 授权后返回网站 –》 获得授权的用户信息 –》 使用这些信息自动为用户建立账号 </p>
</blockquote>
<p>上面的缺点是，整个过程是自动的，用户没有选择用户名、邮箱的权利。尤其是邮箱，由于权限限制，即使授权后也无法获得用户的真实邮箱，所以使用虚拟的邮箱为用户注册后，用户也无法即时从网站得到信息（如评论回复信息）。</p>
<p>新的注册流程，在最后一步，将用户带到一个全新的注册页面，让他输入自己的真实可用的邮箱，这样一来就避免了上面的不足。并且如果用户愿意，他还可以自行更换一个用户名，并修改自己的网站地址（默认是用户的微博地址）。</p>
<p>最重要的是，使用新的注册流程后，旧的注册用户完全不受影响。</p>
<p><img style="display: inline" title="ty" alt="ty" src="http://www.qiqiboy.com/wp-content/uploads/2011/09/ty.png" width="503" height="564" /></p>
<p>欢迎大家去更新最新版。<a href="http://wordpress.org/extend/plugins/social-medias-connect/" target="_blank"><strong>wordpress官方下载地址</strong></a></p>
<p>&#160;</p>
<p>有任何问题可以在新浪微博：<a href="http://weibo.com/qiqiboy" target="_blank">http://weibo.com/qiqiboy</a> 或者我博客任意页面留言交流。</p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/04/smc-plugin.gif&amp;h=100&amp;w=100&amp;zc=1" alt="Social Medias Connect V1.3发布 新增图片同步" class="thumb" /><a href="http://www.qiqiboy.com/2011/04/21/social-medias-connect-v1-3.html" title="Social Medias Connect V1.3发布 新增图片同步">Social Medias Connect V1.3发布 新增图片同步</a> (25)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/04/a9dff5b61cf6.png&amp;h=100&amp;w=100&amp;zc=1" alt="WordPress插件发布: Social Medias Connect" class="thumb" /><a href="http://www.qiqiboy.com/2011/04/15/publish-social-medias-connect.html" title="WordPress插件发布: Social Medias Connect">WordPress插件发布: Social Medias Connect</a> (84)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/05/fanfousmc.png&amp;h=100&amp;w=100&amp;zc=1" alt="有关社交媒体连接插件对饭否、follow5支持的说明" class="thumb" /><a href="http://www.qiqiboy.com/2011/05/12/social-medias-connect-about-fanfou-and-follow5.html" title="有关社交媒体连接插件对饭否、follow5支持的说明">有关社交媒体连接插件对饭否、follow5支持的说明</a> (32)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/04/comemnt-format.png&amp;h=100&amp;w=100&amp;zc=1" alt="Social Medias Connect V1.4更新，自定义同步格式 vs 标签、摘要同步" class="thumb" /><a href="http://www.qiqiboy.com/2011/04/26/social-medias-connect-v1-4.html" title="Social Medias Connect V1.4更新，自定义同步格式 vs 标签、摘要同步">Social Medias Connect V1.4更新，自定义同步格式 vs 标签、摘要同步</a> (50)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/04/ttt.png&amp;h=100&amp;w=100&amp;zc=1" alt="新玩意儿-Social Medias Connect 微博连接" class="thumb" /><a href="http://www.qiqiboy.com/2011/04/14/social-medias-connect-plugin.html" title="新玩意儿-Social Medias Connect 微博连接">新玩意儿-Social Medias Connect 微博连接</a> (67)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/f8">http://qiqi.boy.im/f8<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年05月3日, <a href="http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comment-18207">shadowma</a> say: Error Info: Recv failure: Connection reset by peer
你的主机不被支持，请联系你的主机商重新配置主机。

我博客被牆了。只有性浪和淫淫沒能同步，這倆要從服務器回調什麼？純吐槽，反正同步到這兩個地方也沒什麼意義了</li><li>2012年04月15日, <a href="http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comment-18022">Name (required)</a> say: <blockquote cite="#commentbody-16006">
<strong><a href="#comment-16006" rel="nofollow">笑话皇后</a> :</strong>
博主的博客很专业，我学到了很多东西。目前已经用上了你的一个插件。
</blockquote></li><li>2012年03月17日, <a href="http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comment-17579">AuZeonfung</a> say: 一直在用這個插件，我填入了FB的appid和appsecret但是有動態的時候都不會同步到FB，是這個插件沒有這個功能嗎？還是我人品問題？</li><li>2011年12月16日, <a href="http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comment-16454">蓝颜博客</a> say: 第一次过来，围观一下</li><li>2011年11月26日, <a href="http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comment-16006">笑话皇后</a> say: 博主的博客很专业，我学到了很多东西。目前已经用上了你的一个插件。</li><li>2011年11月14日, <a href="http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comment-15581">微代码-鸿枫业</a> say: 我又来看你的新博了~~支持一下</li><li>2011年11月12日, <a href="http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comment-15571">大学便民网</a> say: 收下了 还不错 之前的bug解决的了不少 但是不知道用户名太长这个解决了没 之前是太长不能注册
顺便问下 你的评论框这的编辑器怎么弄的呢？</li><li>2011年11月3日, <a href="http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html#comment-15403">懒人工具</a> say: <a href="http://www.lrtool.net/" rel="nofollow">懒人</a>已阅，哈哈</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2011/09/16/socila-medias-connect-1-6-update.html/feed</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>wordpress 搜索自定义字段(模糊查询)</title>
		<link>http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html</link>
		<comments>http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comments</comments>
		<pubDate>Wed, 14 Sep 2011 09:11:13 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress技巧]]></category>
		<category><![CDATA[开发]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html</guid>
		<description><![CDATA[如果有关注我博客人，应该会发现最近一周之内博客都一直打不开。我一直以为是主机问题，今天联系了客服，才发现原来是我自己的主题的问题。所以今天花了大半天的时间一点点排除问题，最后发现原来是和gravatar的服务器被墙有关。去掉了头像缓存，问题就解决了。 当然，不会白白更新一篇博客的。下面说一个根据自定义字段查询文章的方法。 query_posts可以实现多种组合查询，但是我遇到的一个问题是，需要搜索自定义字段的值。比如为一个post定义了一个字段“my_address”，它的值表示一个地址，比如“中国 北京 海淀区 北四环路”。如果我们要想通过搜索“北京”这个关键词来找到这篇post，那么通过query_posts就办不到了。 虽然query_posts的查询有“meta_value”这个方法，但是这个必须是完整的值，也就是只有查询“中国 北京 海淀区 北四环路”这个长关键句才能找到文章，而只通过“北京”是会查询失败的。也就是说meta_value是精确查询的，而不能模糊查询。 最后，我琢磨了两种方法，虽然我自己都感觉并不怎么完美。 方法一，通过add_filter处理posts_join、posts_search勾子 add_filter( 'posts_search', 'wp_custom_search' ); function wp_custom_search($search){ if(!isset($_GET['meta_search']))return $search;//通过$_GET['meta_search']确保是要进行meta查询 $s=get_query_var('s'); $search = &#34;AND (((wp_posts.post_title LIKE '%{$s}%') OR (wp_posts.post_content LIKE '%{$s}%') OR (wp_postmeta.meta_value LIKE '%{$s}%') )) AND (wp_posts.post_password = '')&#34;; [...]]]></description>
			<content:encoded><![CDATA[<p>如果有关注我博客人，应该会发现最近一周之内博客都一直打不开。我一直以为是主机问题，今天联系了客服，才发现原来是我自己的主题的问题。所以今天花了大半天的时间一点点排除问题，最后发现原来是和gravatar的服务器被墙有关。去掉了头像缓存，问题就解决了。</p>
<p>当然，不会白白更新一篇博客的。下面说一个根据自定义字段查询文章的方法。</p>
<p>query_posts可以实现多种组合查询，但是我遇到的一个问题是，需要搜索自定义字段的值。比如为一个post定义了一个字段“my_address”，它的值表示一个地址，比如“中国 北京 海淀区 北四环路”。如果我们要想通过搜索“北京”这个关键词来找到这篇post，那么通过query_posts就办不到了。</p>
<p><span id="more-2820"></span>
<p>虽然query_posts的查询有“meta_value”这个方法，但是这个必须是完整的值，也就是只有查询“中国 北京 海淀区 北四环路”这个长关键句才能找到文章，而只通过“北京”是会查询失败的。也就是说meta_value是精确查询的，而不能模糊查询。</p>
<p>最后，我琢磨了两种方法，虽然我自己都感觉并不怎么完美。</p>
<h3>方法一，通过add_filter处理posts_join、posts_search勾子</h3>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">add_filter( <span style="color: #006080">'posts_search'</span>, <span style="color: #006080">'wp_custom_search'</span> );</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">function</span> wp_custom_search($search){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span>(!<span style="color: #0000ff">isset</span>($_GET[<span style="color: #006080">'meta_search'</span>]))<span style="color: #0000ff">return</span> $search;<span style="color: #008000">//通过$_GET['meta_search']确保是要进行meta查询</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $s=get_query_var(<span style="color: #006080">'s'</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $search = <span style="color: #006080">&quot;AND (((wp_posts.post_title LIKE '%{$s}%') </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                OR (wp_posts.post_content LIKE '%{$s}%') </pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                OR (wp_postmeta.meta_value LIKE '%{$s}%')</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">               )) AND (wp_posts.post_password = '')&quot;</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> $search;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">add_filter( <span style="color: #006080">'posts_join'</span>, <span style="color: #006080">'wp_custom_search_join'</span> );</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">function</span> wp_custom_search_join($join){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span>(!<span style="color: #0000ff">isset</span>($_GET[<span style="color: #006080">'meta_search'</span>]))<span style="color: #0000ff">return</span> $join;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $join = <span style="color: #006080">&quot;INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)&quot;</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> $join;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
</div>
</div>
<p>为了不影响其它地方的query，所以我们通过检查是否有一个get请求meta_search，来判断是否要对查询进行处理。</p>
<h3>方法二，将字段信息加入到post_content中</h3>
<p>因为默认的post_title和post_content里的内容是模糊查询的，所以我们可以将postmeta的内容追加到post_content中。手动添加可以，自动加入也行。</p>
<p>下面是自动加入的方法： </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">add_action(<span style="color: #006080">'wp_insert_post_data'</span>,<span style="color: #006080">'wp_my_post'</span>,10,2);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">function</span> wp_my_post($data, $postarr){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $arrmeta=<span style="color: #0000ff">array</span>(<span style="color: #006080">'my_address'</span>,<span style="color: #006080">'meta2'</span>,<span style="color: #006080">'meta3'</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $info=<span style="color: #006080">'&lt;span style=&quot;display:none;color:#fff;&quot;&gt;'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">foreach</span>($arrmeta <span style="color: #0000ff">as</span> $meta){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        $info .= <span style="color: #006080">' '</span>.$_POST[$meta];</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $info.=<span style="color: #006080">'&lt;/span&gt;'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $data[<span style="color: #006080">'post_content'</span>] .= $info;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> $data;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
</div>
</div>
<p>仅供参考。</p>
<p>如果你还有更好的方法,欢迎与我交流分享。</p>
<p><img style="display: inline" title="rrr" alt="rrr" src="http://www.qiqiboy.com/wp-content/uploads/2011/09/rrr.png" width="464" height="348" /></p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/08/demo.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress 按首字母排列文章/检索文章" class="thumb" /><a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html" title="wordpress 按首字母排列文章/检索文章">wordpress 按首字母排列文章/检索文章</a> (19)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress开发 - 仿淫淫网新鲜事评论的评论列表实现" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html" title="wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现">wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</a> (49)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/06/5.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress的微博时间显示方法" class="thumb" /><a href="http://www.qiqiboy.com/2011/06/10/sina-weibo-timestamp-function-2.html" title="wordpress的微博时间显示方法">wordpress的微博时间显示方法</a> (19)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/1d7a79196621_DAE1/434.png&amp;h=100&amp;w=100&amp;zc=1" alt="仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/16/visitor-information-tencent-suspended-micro-display.html" title="仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）">仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）</a> (110)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 让拖动支持iphone/ipad触摸" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html" title="JavaScript: 让拖动支持iphone/ipad触摸">JavaScript: 让拖动支持iphone/ipad触摸</a> (15)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/f7">http://qiqi.boy.im/f7<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年04月16日, <a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comment-18025">beibei</a> say: 还是不会使用，我想在搜索中含自定义字段!</li><li>2012年03月24日, <a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comment-17670">citier</a> say: Q大求救，wordpress多关键字分类筛选怎么做，有点类似你这个，纠结中</li><li>2012年02月7日, <a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comment-17125">joysk</a> say: 啊哈，头像还在的啊？</li><li>2011年12月12日, <a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comment-16353">胡实</a> say: 挖宝中 你懂得</li><li>2011年11月19日, <a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comment-15704">beyondme</a> say: "Fuck you! Ni Ma Bi!" 这什么意思，网站不能留言了？</li><li>2011年10月29日, <a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comment-15249">宝宝健康成长</a> say: 新的theme很给力啊！</li><li>2011年10月3日, <a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comment-14919">wmtimes</a> say: 模糊查询啊。主题完成了再试。</li><li>2011年09月28日, <a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html#comment-14757">软件风暴</a> say: 赶紧试试去 真不错</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>wordpress 按首字母排列文章/检索文章</title>
		<link>http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html</link>
		<comments>http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comments</comments>
		<pubDate>Wed, 10 Aug 2011 08:01:14 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[开发]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[网站开发]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html</guid>
		<description><![CDATA[从标题中可以看出，本文要讲两个方面内容： 第一，按标题首字母排列文章 这个简单，只需在循环（loop）前，添加 /** * 方式一，直接添加查询字符串 */ &#60;?php query_posts( $query_string . '&#38;orderby=title&#38;order=asc' ); ?&#62; /** * 方式二，合并查询数组 */ &#60;?php $args=array_merge( $wp_query-&#62;query, array( 'orderby' =&#62; 'title', 'order' =&#62; 'asc' ) ); query_posts($args); ?&#62; 注: query_posts($args)用来改变主循环，相关使用方法可查询wordpress官方说明文档。 第二，按首标题字母检索文章 这个普通用户可能用处不大，但是对于一些将wordpress用来做产品展示的网站来说，按照字母名称快速查询相关产品则是一个很基本的需求。最近在一个项目中有用到，研究了wordpress的query后，一点小心得在这里分享出来。 既然是检索，那肯定就是要用到”s=word”这个查询变量了。比如查找以字母“A”开头的文章 &#60;?php query_posts('s=A'); ?&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>从标题中可以看出，本文要讲两个方面内容：</p>
<h3>第一，按标题首字母排列文章</h3>
<p>这个简单，只需在循环（loop）前，添加</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;">/**</span></pre>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;"> * 方式一，直接添加查询字符串</span></pre>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;"> */</span></pre>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">&lt;?php query_posts( $query_string . <span style="color: #006080;">'&amp;orderby=title&amp;order=asc'</span> ); ?&gt;</pre>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"></pre>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;">/**</span></pre>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;"> * 方式二，合并查询数组</span></pre>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000;"> */</span></pre>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">&lt;?php $args=array_merge( $wp_query-&gt;query, <span style="color: #0000ff;">array</span>( <span style="color: #006080;">'orderby'</span> =&gt; <span style="color: #006080;">'title'</span>, <span style="color: #006080;">'order'</span> =&gt; <span style="color: #006080;">'asc'</span> ) );</pre>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    query_posts($args); ?&gt;</pre>

</div>
</div>
<p><strong>注</strong>: <span style="text-decoration: underline;"><em>query_posts($args)</em></span>用来改变主循环，相关使用方法可查询<a href="http://codex.wordpress.org/Template_Tags/query_posts" target="_blank">wordpress官方</a>说明文档。</p>
<p><span id="more-2818"></span></p>
<h3>第二，按首标题字母检索文章</h3>
<p>这个普通用户可能用处不大，但是对于一些将wordpress用来做产品展示的网站来说，按照字母名称快速查询相关产品则是一个很基本的需求。最近在一个项目中有用到，研究了wordpress的query后，一点小心得在这里分享出来。</p>
<p>既然是检索，那肯定就是要用到”s=word”这个查询变量了。比如查找以字母“A”开头的文章</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">&lt;?php query_posts(<span style="color: #006080;">'s=A'</span>); ?&gt;</pre>

</div>
</div>
<p>这样的话,wordpress会通过标题和内容查找包含字母A的文章,而不是我们需要的”以字母A开头的文章”.要达到我们的目的应该怎么做呢？</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">add_filter( <span style="color: #006080;">'posts_search'</span>, <span style="color: #006080;">'wp_custom_search'</span> );</pre>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff;">function</span> wp_custom_search($search){</pre>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    $s=get_query_var(<span style="color: #006080;">'s'</span>);</pre>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    <span style="color: #0000ff;">if</span>(!$s)<span style="color: #0000ff;">return</span> $search;<span style="color: #008000;">//非搜索，直接返回。</span></pre>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    $search = <span style="color: #006080;">"AND (((wp_ymimds_posts.post_title LIKE '{$s}%'))) AND (wp_ymimds_posts.post_password = '')"</span>;<span style="color: #008000;">//会sql的你应该懂得，模糊查询</span></pre>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    <span style="color: #0000ff;">return</span> $search;</pre>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0px; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">}</pre>

</div>
</div>
<p>将以上代码放到主题的functions.php中即可。</p>
<p>demo可看我在项目中的具体应用。</p>
<p><strong><a href="http://www.soewp.devave.com/directory/?browse=membername" target="_blank"><span style="font-size: x-small;">查询以某一字母开头的文章示例</span></a></strong></p>
<p><img style="display: inline;" title="demo" src="http://www.qiqiboy.com/wp-content/uploads/2011/08/demo.png" alt="demo" width="600" height="431" /></p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/09/rrr.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress 搜索自定义字段(模糊查询)" class="thumb" /><a href="http://www.qiqiboy.com/2011/09/14/query-posts-by-postmeta.html" title="wordpress 搜索自定义字段(模糊查询)">wordpress 搜索自定义字段(模糊查询)</a> (20)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/renren.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress开发 - 仿淫淫网新鲜事评论的评论列表实现" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/13/wordpress-comemnts-like-renren.html" title="wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现">wordpress开发 &#8211; 仿淫淫网新鲜事评论的评论列表实现</a> (49)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/06/5.png&amp;h=100&amp;w=100&amp;zc=1" alt="wordpress的微博时间显示方法" class="thumb" /><a href="http://www.qiqiboy.com/2011/06/10/sina-weibo-timestamp-function-2.html" title="wordpress的微博时间显示方法">wordpress的微博时间显示方法</a> (19)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2010/1d7a79196621_DAE1/434.png&amp;h=100&amp;w=100&amp;zc=1" alt="仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）" class="thumb" /><a href="http://www.qiqiboy.com/2010/08/16/visitor-information-tencent-suspended-micro-display.html" title="仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）">仿腾讯微博式访客信息悬浮显示（JavaScript &amp; ajax）</a> (110)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 让拖动支持iphone/ipad触摸" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html" title="JavaScript: 让拖动支持iphone/ipad触摸">JavaScript: 让拖动支持iphone/ipad触摸</a> (15)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/f5">http://qiqi.boy.im/f5<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2011年11月9日, <a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comment-15528">微代码</a> say: <span style="color:#FF0000;">非常不错的博客，顶一个，欢迎回访，更欢迎互换链接</span></li><li>2011年11月3日, <a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comment-15405">懒人工具</a> say: 不错，受益了</li><li>2011年09月2日, <a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comment-12726">扒站</a> say: 很专业的博客,受益匪浅.</li><li>2011年08月26日, <a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comment-12620">zhbconan</a> say: 隔壁工位的哥们介绍我看你的网站，做的很不错，希望以后可以多向你学习。</li><li>2011年08月23日, <a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comment-12600">c</a> say: 感觉你的博客有点像cms了哦。。 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_surprised.gif' alt=':eek:' class='wp-smiley' /> </li><li>2011年08月16日, <a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comment-12495">美容护肤小窍门</a> say: 通过百度访问到您的博客
内容很好
页面很漂亮
以后会常来看看你的博文的
谢谢你的分享</li><li>2011年08月14日, <a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comment-12450">loosky</a> say: 有的时候的却需要这个功能。</li><li>2011年08月13日, <a href="http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html#comment-12446">毕节教育网</a> say: 代码看不明白。</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2011/08/10/wordpress-search-post-by-first-char.html/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>JavaScript: 支持iphone、ipad 使用两根手指放大图片</title>
		<link>http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html</link>
		<comments>http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comments</comments>
		<pubDate>Sun, 17 Jul 2011 07:13:20 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[触摸]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html</guid>
		<description><![CDATA[昨天写了一篇《 JavaScript: 让拖动支持iphone/ipad触摸 》，今天又无聊，想到了图片放大(zoom)，让使用ios设备的的用户可以使用两根手指来缩放图片。想了一下，很容易就实现了。 其实原理也就是在图片接收了两个有效触摸点后，在手指移动过程中检测两点之间的距离的变化，以此来对图片进行放大缩小。 不多说，demo在这里（必须使用ios设备查看）。代码如下： var getZoomClass=(function(){ var SupportsTouches = (&#34;createTouch&#34; in document),//判断是否支持触摸 $=function(id){ return document.getElementById(id); }, preventDefault=function(ev){ if(ev)ev.preventDefault(); else window.event.returnValue = false; }, getTwoPointSub=function(ev){ var x1=x2=y1=y2=0,sub; x1=ev.touches.item(0).pageX;x2=ev.touches.item(1).pageX; y1=ev.touches.item(0).pageY;y2=ev.touches.item(1).pageY; sub=Math.round(Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2))); return sub; }, getSize=function(img){ return {width:img.width,height:img.height}; }; function _zoom(opt){ [...]]]></description>
			<content:encoded><![CDATA[<p>昨天写了一篇《 <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html">JavaScript: 让拖动支持iphone/ipad触摸</a> 》，今天又无聊，想到了图片放大(zoom)，让使用ios设备的的用户可以使用两根手指来缩放图片。想了一下，很容易就实现了。</p>
<p>其实原理也就是在图片接收了两个有效触摸点后，在手指移动过程中检测两点之间的距离的变化，以此来对图片进行放大缩小。</p>
<p>  <span id="more-2816"></span>
<p>不多说，<a href="http://u.boy.im/zoom" target="_blank"><strong>demo在这里</strong></a>（必须使用ios设备查看）。代码如下：</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">var</span> getZoomClass=(<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">var</span> SupportsTouches = (<span style="color: #006080">&quot;createTouch&quot;</span> <span style="color: #0000ff">in</span> document),<span style="color: #008000">//判断是否支持触摸</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $=<span style="color: #0000ff">function</span>(id){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> document.getElementById(id);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    preventDefault=<span style="color: #0000ff">function</span>(ev){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span>(ev)ev.preventDefault();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">else</span> window.<span style="color: #0000ff">event</span>.returnValue = <span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    getTwoPointSub=<span style="color: #0000ff">function</span>(ev){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> x1=x2=y1=y2=0,sub;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        x1=ev.touches.item(0).pageX;x2=ev.touches.item(1).pageX;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        y1=ev.touches.item(0).pageY;y2=ev.touches.item(1).pageY;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        sub=Math.round(Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2)));</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> sub;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    getSize=<span style="color: #0000ff">function</span>(img){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> {width:img.width,height:img.height};</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    };</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">function</span> _zoom(opt){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span>(!SupportsTouches)<span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.el=<span style="color: #0000ff">typeof</span> opt.el==<span style="color: #006080">'string'</span>?$(opt.el):opt.el;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.onstart=opt.start || <span style="color: #0000ff">new</span> Function();<span style="color: #008000">//</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.onmove=opt.move || <span style="color: #0000ff">new</span> Function();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.onend=opt.end || <span style="color: #0000ff">new</span> Function();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.action=<span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.init();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    _zoom.prototype={</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        init:<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.el[<span style="color: #006080">'ontouchstart'</span>]=<span style="color: #0000ff">this</span>.bind(<span style="color: #0000ff">function</span>(e){<span style="color: #008000">//绑定节点的 [鼠标按下/触摸开始] 事件</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">if</span>(<span style="color: #0000ff">this</span>.action || e.touches.length&lt;2)<span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;<span style="color: #008000">//这里监测了触摸点的数量，小于两个说明不是在进行缩放操作</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">else</span> <span style="color: #0000ff">this</span>.action=<span style="color: #0000ff">true</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                preventDefault(e);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">this</span>.startSub=getTwoPointSub(e);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">this</span>.startSize=getSize(<span style="color: #0000ff">this</span>.el);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">this</span>.onstart();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                document.ontouchmove=<span style="color: #0000ff">this</span>.bind(<span style="color: #0000ff">function</span>(e){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">if</span>(e.touches.length&gt;1){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                        preventDefault(e);<span style="color: #008000">//取消文档的默认行为[鼠标移动、触摸移动]</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                        <span style="color: #0000ff">this</span>.nowSub=getTwoPointSub(e);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                        <span style="color: #0000ff">this</span>.el.width=<span style="color: #0000ff">this</span>.startSize.width*<span style="color: #0000ff">this</span>.nowSub/<span style="color: #0000ff">this</span>.startSub;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                        <span style="color: #0000ff">this</span>.el.height=<span style="color: #0000ff">this</span>.startSize.height*<span style="color: #0000ff">this</span>.nowSub/<span style="color: #0000ff">this</span>.startSub;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                        <span style="color: #0000ff">this</span>.onmove();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                },<span style="color: #0000ff">this</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                document.ontouchend=document.ontouchcancel=<span style="color: #0000ff">this</span>.bind(<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    document.ontouchend=document.ontouchcancel=document.ontouchmove=<span style="color: #0000ff">null</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">this</span>.action=<span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">this</span>.onend();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                },<span style="color: #0000ff">this</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            },<span style="color: #0000ff">this</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        bind:<span style="color: #0000ff">function</span>(fn,obj){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> <span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                fn.apply(obj,arguments);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        tool:<span style="color: #0000ff">null</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> <span style="color: #0000ff">function</span>(opt){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #0000ff">new</span> _zoom(opt);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">})();</pre>
</div>
</div>
<p><a href="http://u.boy.im/zoom" target="_blank"><strong>demo在这里</strong></a>（必须使用ios设备查看）。<img src="http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg" /></p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/01/688860f891c5.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchSlider 1.0 - 兼容触摸屏手机与PC的幻灯片" class="thumb" /><a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html" title="TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片">TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片</a> (16)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/04/QQ20120409181449.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯" class="thumb" /><a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html" title="TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯">TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯</a> (10)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/04/touscroll.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案" class="thumb" /><a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html" title="TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案">TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案</a> (11)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 让拖动支持iphone/ipad触摸" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html" title="JavaScript: 让拖动支持iphone/ipad触摸">JavaScript: 让拖动支持iphone/ipad触摸</a> (15)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/05/imgready.png&amp;h=100&amp;w=100&amp;zc=1" alt="javascript 图片预加载（远程获取图片尺寸）" class="thumb" /><a href="http://www.qiqiboy.com/2011/05/20/javascript-image-preload.html" title="javascript 图片预加载（远程获取图片尺寸）">javascript 图片预加载（远程获取图片尺寸）</a> (29)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/ez">http://qiqi.boy.im/ez<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年02月21日, <a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comment-17210">地方</a> say: gggggggggggg</li><li>2012年02月21日, <a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comment-17209">地方</a> say: 对方的身份</li><li>2011年10月25日, <a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comment-15226">懒人</a> say: 我还在折腾安卓</li><li>2011年07月31日, <a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comment-12288">晨光</a> say: 这方面懂得还是很少呀</li><li>2011年07月25日, <a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comment-12259">丰禾棋牌</a> say: 电脑这方面不是特别懂  学习了</li><li>2011年07月24日, <a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comment-12255">小五</a> say: 没有接触过IP4</li><li>2011年07月23日, <a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comment-12250">孤夜狂狼</a> say: Android 平板 XOOM 测试成功…… 
好东西啊~ 收藏了~  虽然暂时没有什么用法方面的创意……</li><li>2011年07月23日, <a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html#comment-12248">人好哇！</a> say: 唔。。。我表示现在为IOS做的优化随处可见了呢~~不过还真没想过JS还可以这么搞，哈哈</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>JavaScript: 让拖动支持iphone/ipad触摸</title>
		<link>http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html</link>
		<comments>http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comments</comments>
		<pubDate>Sat, 16 Jul 2011 10:40:34 +0000</pubDate>
		<dc:creator>qiqiboy</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[前端]]></category>
		<category><![CDATA[开发]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[触摸]]></category>

		<guid isPermaLink="false">http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html</guid>
		<description><![CDATA[一般的通过mousedown、mousemove、mouseup等打造的拖动，仅仅在普通的键盘+鼠标的电脑设备上可以工作。而到了ios设备上（iphone itouch ipad），则不能工作了。最近因为做个东西，需要支持ios设备，所以只好看了下webkit浏览器的触摸事件。 其实也很简单，对应mousedown、mousemove、mouseup的触摸事件分别是touchstart、touchmove、touchend。为了写个demo，花了不少的时间，所以为了节省时间，我文章里就不多说了，仅贴一下相关代码。 DEMO可以在此查看。 var getDragClass=(function(){ var SupportsTouches = (&#34;createTouch&#34; in document),//判断是否支持触摸 StartEvent = SupportsTouches ? &#34;touchstart&#34; : &#34;mousedown&#34;,//支持触摸式使用相应的事件替代 MoveEvent = SupportsTouches ? &#34;touchmove&#34; : &#34;mousemove&#34;, EndEvent = SupportsTouches ? &#34;touchend&#34; : &#34;mouseup&#34;, $=function(id){ return document.getElementById(id); }, preventDefault=function(ev){ if(ev)ev.preventDefault(); [...]]]></description>
			<content:encoded><![CDATA[<p>一般的通过mousedown、mousemove、mouseup等打造的拖动，仅仅在普通的键盘+鼠标的电脑设备上可以工作。而到了ios设备上（iphone itouch ipad），则不能工作了。最近因为做个东西，需要支持ios设备，所以只好看了下webkit浏览器的触摸事件。</p>
<p>其实也很简单，对应mousedown、mousemove、mouseup的触摸事件分别是touchstart、touchmove、touchend。为了写个demo，花了不少的时间，所以为了节省时间，我文章里就不多说了，仅贴一下相关代码。</p>
<p>  <span id="more-2815"></span>
<p><a href="http://u.boy.im/touchdrag" target="_blank"><strong><u>DEMO可以在此查看。</u></strong></a></p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">var</span> getDragClass=(<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"><span style="color: #0000ff">var</span> SupportsTouches = (<span style="color: #006080">&quot;createTouch&quot;</span> <span style="color: #0000ff">in</span> document),<span style="color: #008000">//判断是否支持触摸</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    StartEvent = SupportsTouches ? <span style="color: #006080">&quot;touchstart&quot;</span> : <span style="color: #006080">&quot;mousedown&quot;</span>,<span style="color: #008000">//支持触摸式使用相应的事件替代</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    MoveEvent = SupportsTouches ? <span style="color: #006080">&quot;touchmove&quot;</span> : <span style="color: #006080">&quot;mousemove&quot;</span>,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    EndEvent = SupportsTouches ? <span style="color: #006080">&quot;touchend&quot;</span> : <span style="color: #006080">&quot;mouseup&quot;</span>,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    $=<span style="color: #0000ff">function</span>(id){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> document.getElementById(id);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    preventDefault=<span style="color: #0000ff">function</span>(ev){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">if</span>(ev)ev.preventDefault();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">else</span> window.<span style="color: #0000ff">event</span>.returnValue = <span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    getMousePoint=<span style="color: #0000ff">function</span>(ev){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">var</span> x = y = 0,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            doc = document.documentElement,</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            body = document.body;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span>(!ev) ev=window.<span style="color: #0000ff">event</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span> (window.pageYoffset) {</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                x = window.pageXOffset;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                y = window.pageYOffset;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }<span style="color: #0000ff">else</span>{</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                x = (doc &amp;&amp; doc.scrollLeft || body &amp;&amp; body.scrollLeft || 0) - (doc &amp;&amp; doc.clientLeft || body &amp;&amp; body.clientLeft || 0);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                y = (doc &amp;&amp; doc.scrollTop  || body &amp;&amp; body.scrollTop  || 0) - (doc &amp;&amp; doc.clientTop  || body &amp;&amp; body.clientTop  || 0);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">if</span>(SupportsTouches){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">var</span> evt = ev.touches.item(0);<span style="color: #008000">//仅支持单点触摸,第一个触摸点</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                x=evt.pageX;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                y=evt.pageY;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }<span style="color: #0000ff">else</span>{</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                x += ev.clientX;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                y += ev.clientY;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> {<span style="color: #006080">'x'</span> : x, <span style="color: #006080">'y'</span> : y};</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    };</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">function</span> _drag(opt){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.el=<span style="color: #0000ff">typeof</span> opt.el==<span style="color: #006080">'string'</span>?$(opt.el):opt.el;<span style="color: #008000">//被拖动节点</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.onstart=opt.start || <span style="color: #0000ff">new</span> Function();<span style="color: #008000">//</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.onmove=opt.move || <span style="color: #0000ff">new</span> Function();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.onend=opt.end || <span style="color: #0000ff">new</span> Function();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.action=<span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">this</span>.init();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    _drag.prototype={</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        init:<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.el.style.position=<span style="color: #006080">'relative'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">this</span>.el[<span style="color: #006080">'on'</span>+StartEvent]=<span style="color: #0000ff">this</span>.bind(<span style="color: #0000ff">function</span>(e){<span style="color: #008000">//绑定节点的 [鼠标按下/触摸开始] 事件</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                preventDefault(e);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">if</span>(<span style="color: #0000ff">this</span>.action)<span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">else</span> <span style="color: #0000ff">this</span>.action=<span style="color: #0000ff">true</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">this</span>.startPoint=getMousePoint(e);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                <span style="color: #0000ff">this</span>.onstart();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                document[<span style="color: #006080">'on'</span>+MoveEvent]=<span style="color: #0000ff">this</span>.bind(<span style="color: #0000ff">function</span>(e){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    preventDefault(e);<span style="color: #008000">//取消文档的默认行为[鼠标移动、触摸移动]</span></pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">this</span>.nowPoint=getMousePoint(e);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">this</span>.el.style.left=<span style="color: #0000ff">this</span>.nowPoint.x-<span style="color: #0000ff">this</span>.startPoint.x+<span style="color: #006080">'px'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">this</span>.el.style.top=<span style="color: #0000ff">this</span>.nowPoint.y-<span style="color: #0000ff">this</span>.startPoint.y+<span style="color: #006080">'px'</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">this</span>.onmove();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                },<span style="color: #0000ff">this</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                document[<span style="color: #006080">'on'</span>+EndEvent]=document[<span style="color: #006080">'ontouchcancel'</span>]=<span style="color: #0000ff">this</span>.bind(<span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    document[<span style="color: #006080">'on'</span>+EndEvent]=document[<span style="color: #006080">'ontouchcancel'</span>]=document[<span style="color: #006080">'on'</span>+MoveEvent]=<span style="color: #0000ff">null</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">this</span>.action=<span style="color: #0000ff">false</span>;</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                    <span style="color: #0000ff">this</span>.onend();</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                },<span style="color: #0000ff">this</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            },<span style="color: #0000ff">this</span>);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        },</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        bind:<span style="color: #0000ff">function</span>(fn,obj){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">return</span> <span style="color: #0000ff">function</span>(){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">                fn.apply(obj,arguments);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> <span style="color: #0000ff">function</span>(opt){</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        <span style="color: #0000ff">return</span> <span style="color: #0000ff">new</span> _drag(opt);</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>

<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0px; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">})();</pre>
</div>
</div>
<p>其实就是很简单的了，需要注意跌其实就是获取鼠标坐(getMousePoint)标的那里了，touches.item(0)表示第一个生效触摸点。</p>
<p><a href="http://u.boy.im/touchdrag" target="_blank"><strong><u>DEMO可以在此查看。</u></strong></a>（触摸效果请使用ios相关设备）</p>
<p>也可以查看<a href="http://www.qiqiboy.com/demo/2008/09/layout-test.html">http://www.qiqiboy.com/demo/2008/09/layout-test.html</a> 的那个评分拖动长条。<img style="display: inline" title="810CI55J_0" alt="810CI55J_0" src="http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg" width="500" height="331" /></p>
<ul class="related_post"><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/07/810CI55J_0.jpg&amp;h=100&amp;w=100&amp;zc=1" alt="JavaScript: 支持iphone、ipad 使用两根手指放大图片" class="thumb" /><a href="http://www.qiqiboy.com/2011/07/17/javascript-touch-support-zoom-image.html" title="JavaScript: 支持iphone、ipad 使用两根手指放大图片">JavaScript: 支持iphone、ipad 使用两根手指放大图片</a> (20)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2011/01/mouseEnter.png&amp;h=100&amp;w=100&amp;zc=1" alt="优化javascript中mouseover和mouseout事件" class="thumb" /><a href="http://www.qiqiboy.com/2011/01/19/javascript-mouseover-and-mouseout.html" title="优化javascript中mouseover和mouseout事件">优化javascript中mouseover和mouseout事件</a> (30)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/04/QQ20120409181449.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯" class="thumb" /><a href="http://www.qiqiboy.com/2012/04/09/touchsliderbox-v1-0-publish-2.html" title="TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯">TouchSliderBox 1.0 &ndash;容器宽度可变的幻灯</a> (10)</li><li><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/04/touscroll.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案" class="thumb" /><a href="http://www.qiqiboy.com/2012/04/01/touchscroll-v1-0-publish.html" title="TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案">TouchScroll 1.0 &ndash; 统一视觉样式的容器滚动解决方案</a> (11)</li><li class="last"><img src="http://www.qiqiboy.com/wp-content/themes/windPaled/timthumb.php?src=http://www.qiqiboy.com/wp-content/uploads/2012/01/688860f891c5.png&amp;h=100&amp;w=100&amp;zc=1" alt="TouchSlider 1.0 - 兼容触摸屏手机与PC的幻灯片" class="thumb" /><a href="http://www.qiqiboy.com/2012/01/11/touchslider-1-0-publish.html" title="TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片">TouchSlider 1.0 &#8211; 兼容触摸屏手机与PC的幻灯片</a> (16)</li></ul><p><strong>声明:</strong> 本站遵循 <a href="http:\/\/creativecommons.org/licenses/by-nc-sa/3.0/">署名-非商业性使用-相同方式共享 3.0</a> 共享协议. 转载请注明转自 <a href="http://www.qiqiboy.com">I'm qiqiboy !</a> </p> <p>本文地址: <a href="http://qiqi.boy.im/ey">http://qiqi.boy.im/ey<a></p><span style="background:#cc5566;color:#fffff;"><h4>Look, this post is replyed so hot, let's go O(∩_∩)O~.</h4></span><h3>Related comments</h3><ul><li>2012年03月14日, <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comment-17552">学前端 &raquo; JavaScript: 支持iphone、ipad 使用两根手指放大图</a> say: [...] JavaScript: 让拖动支持iphone/ipad触摸 [...]</li><li>2011年12月6日, <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comment-16295">心随雨下</a> say: 你好，这个效果确实不错。但是，我想问一下，如果是地图怎样可以实现这样的拖动效果呢？</li><li>2011年07月18日, <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comment-12146">无冷</a> say: 这个东西比ui插件好用多了</li><li>2011年07月18日, <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comment-12144">IM路人</a> say: 高级技术文哟~~~~</li><li>2011年07月18日, <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comment-12140">QiQiBoY</a> say: <a href="#comment-12122" rel="nofollow">@刘印 </a> 
基本上新款都是了。。而且只会越来越多</li><li>2011年07月17日, <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comment-12139">QiQiBoY</a> say: <a href="#comment-12121" rel="nofollow">@WayJam </a> 
嗯。现在这种用户很多。。其实这个好像包括安卓系统也适用</li><li>2011年07月17日, <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comment-12138">QiQiBoY</a> say: <a href="#comment-12120" rel="nofollow">@A.shun </a> 
 <img src='http://www.qiqiboy.com/wp-content/themes/windPaled/images/smiles/icon_biggrin.gif' alt=':grin:' class='wp-smiley' />  哈哈。</li><li>2011年07月17日, <a href="http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html#comment-12131">JavaScript: 支持iphone、ipad 使用两根手指放大图片 - I&#039;m qiqiboy !</a> say: [...] JavaScript: 让拖动支持iphone/ipad触摸 [...]</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.qiqiboy.com/2011/07/16/javascript-touch-drag-support.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

