PageRenderTime 54ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/1.2/docs/html/demo/component/datalazyload/demo3.html

https://github.com/yiminghe/kissyteam.github.com
HTML | 274 lines | 215 code | 28 blank | 31 comment | 0 complexity | ac505dadda6ca08d20cebd9b2ac8b86f MD5 | raw file
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>DataLazyload 手动模式 &mdash; KISSY v1.2 Documentation</title>
  6. <link rel="stylesheet" href="http://a.tbcdn.cn/s/kissy/1.2.0/css/reset.css"/>
  7. <link rel="stylesheet" href="../../../_static/kissy.css"/>
  8. <link rel="stylesheet" href="../../../_static/pygments.css"/>
  9. <link rel="shortcut icon" href="http://a.tbcdn.cn/s/kissy/favicon.ico" type="image/x-icon" />
  10. <link href='http://fonts.googleapis.com/css?family=Philosopher' rel='stylesheet' type='text/css'>
  11. <script>
  12. var DOCUMENTATION_OPTIONS = {
  13. URL_ROOT: '../../../',
  14. VERSION: '',
  15. COLLAPSE_INDEX: false,
  16. FILE_SUFFIX: '.html',
  17. HAS_SOURCE: true
  18. };
  19. (function(){
  20. var js=[],h=window.location.href,d=document;
  21. js.push("../../../_static/jquery.js");
  22. js.push("../../../_static/underscore.js");
  23. js.push("../../../_static/doctools.js");
  24. for(var i=0;i<js.length;i++){
  25. var j=js[i];
  26. if(h.indexOf("localhost/kissy_git/")==-1&&j.indexOf("jquery.js")!=-1){
  27. d.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"><\/script>');
  28. }else{
  29. d.write('<script type="text/javascript" src="'+ j +'"><\/script>');
  30. }
  31. }
  32. })();
  33. </script>
  34. <script>
  35. var _gaq = _gaq || [];
  36. _gaq.push(['_setAccount', 'UA-31470541-1']);
  37. _gaq.push(['_trackPageview']);
  38. (function() {
  39. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  40. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  41. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  42. })();
  43. </script>
  44. </head>
  45. <body><div id="header">
  46. <h1 class="logo"><a alt="KISSY" href="http://docs.kissyui.com">
  47. <img src="http://a.tbcdn.cn/s/kissy/logo.png" />
  48. </a></h1>
  49. <ul class="navigation">
  50. <li><a href="http://docs.kissyui.com">首页</a></li>
  51. <li><a href="../../../../html/tutorials/index.html" >Tutorials</a></li>
  52. <li><a href="../../../../html/api/index.html" >API</a></li>
  53. <li><a href="../../../../html/demo/index.html" >DEMO</a></li>
  54. <li><a href="https://groups.google.com/group/kissy-ui" >Google Group</a></li>
  55. <li><a href="http://www.github.com/kissyteam" >Source Code</a></li>
  56. <li><a href="http://docs.kissyui.com/kissy/docs/" >English API Docs</a></li>
  57. </ul>
  58. <div id="searchbox" style="display: none" class="searchbox">
  59. <form class="search" action="../../../search.html" method="get">
  60. <input type="text" name="q" size="28" class="ipt"/>
  61. <input type="submit" value="Go" class="btn"/>
  62. <input type="hidden" name="check_keywords" value="yes" />
  63. <input type="hidden" name="area" value="default" />
  64. </form>
  65. </div>
  66. <script type="text/javascript">$('#searchbox').show(0);</script>
  67. </div>
  68. <div id="content">
  69. <div class="layout grid-s6m0">
  70. <div class="col-main">
  71. <div class="main-wrap">
  72. <div class='related'>
  73. <h3>Navigation</h3>
  74. <ul>
  75. <li class="right" style="margin-right: 10px">
  76. <a href="../../../genindex.html" title="General Index"
  77. accesskey="I">index</a></li>
  78. <li class="right" >
  79. <a href="../../../py-modindex.html" title="Python Module Index"
  80. >modules</a> | </li>
  81. <li class="right" >
  82. <a href="demo4.html" title="textarea 延迟加载"
  83. accesskey="N">next</a> | </li>
  84. <li class="right" >
  85. <a href="demo2.html" title="DataLazyload 自动模式"
  86. accesskey="P">previous</a> | </li>
  87. <li><a href="../../../index.html">KISSY v1.2 Documentation</a> &#187; </li>
  88. <li><a href="../../index.html" >Demos</a> &#187; </li>
  89. <li><a href="../index.html" >Component</a> &#187; </li>
  90. <li><a href="index.html" accesskey="U">DataLazyload 使用示例</a> &#187; </li>
  91. </ul>
  92. </div>
  93. <div class="section" id="datalazyload">
  94. <h1>DataLazyload 手动模式<a class="headerlink" href="#datalazyload" title="Permalink to this headline"></a></h1>
  95. <div class="section" id="class">
  96. <h2>Class<a class="headerlink" href="#class" title="Permalink to this headline"></a></h2>
  97. <blockquote>
  98. <div><ul class="simple">
  99. <li><a class="reference internal" href="../../../api/component/datalazyload/index.html#datalazyload.DataLazyload" title="datalazyload.DataLazyload"><tt class="xref py py-class docutils literal"><span class="pre">DataLazyload</span></tt></a></li>
  100. </ul>
  101. </div></blockquote>
  102. </div>
  103. <div class="section" id="id1">
  104. <h2>DataLazyload 手动模式<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
  105. <blockquote>
  106. <div><iframe width="100%" height="450" class="iframe-demo" src="../../../_static/demo/datalazyload/manual_demo.html"></iframe><p>页面加载的时候采用了懒加载向下滚动的时候才会加载后面的图片网速快的时候不很明显网速慢的时候就会显示出懒加载的优点你可以使用firefox或者ie开发工具中的网络工具查看懒加载过程</p>
  107. <p><strong>载入1.2 kissy</strong></p>
  108. <div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;script </span><span class="na">src=</span><span class="s">&quot;http://a.tbcdn.cn/s/kissy/1.2.0/kissy-min.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span>
  109. </pre></div>
  110. </div>
  111. <p><strong>使用DataLazyload</strong></p>
  112. <div class="highlight-js"><div class="highlight"><pre><span class="nx">KISSY</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s1">&#39;datalazyload&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">S</span><span class="p">,</span> <span class="nx">DataLazyload</span><span class="p">)</span> <span class="p">{</span>
  113. <span class="nx">S</span><span class="p">.</span><span class="nx">ready</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">S</span><span class="p">)</span> <span class="p">{</span>
  114. <span class="kd">var</span> <span class="nx">dataLazyload</span><span class="o">=</span> <span class="nx">DataLazyload</span><span class="p">();</span>
  115. <span class="p">});</span>
  116. <span class="p">});</span>
  117. </pre></div>
  118. </div>
  119. <p><strong>注意事项</strong></p>
  120. <blockquote>
  121. <div>采用手动模式时, 需要自行在输出页面时, 可以不设置 img src 属性, 但是必须设置 img <tt class="docutils literal"><span class="pre">data-ks-lazyload</span></tt> 自定义属性为真实图片地址,当滚动导致该图片出现在当前视窗时会将 src 设置为真实地址, :</div></blockquote>
  122. <div class="highlight-html"><div class="highlight"><pre><span class="nt">&lt;img</span> <span class="na">data-ks-lazyload=</span><span class="s">&quot;xx.jpg&quot;</span> <span class="nt">/&gt;</span>
  123. </pre></div>
  124. </div>
  125. <p><strong>使用回调函数</strong></p>
  126. <p>使用回调函数 addCallback() 方法可以让我们定义的部分将要显示的时候出发函数执行我们的代码,</p>
  127. <div class="highlight-js"><div class="highlight"><pre><span class="nx">dataLazyload</span><span class="p">.</span><span class="nx">addCallback</span><span class="p">(</span><span class="s1">&#39;#test-callback&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  128. <span class="nx">alert</span><span class="p">(</span><span class="s1">&#39;#test-callback will come!&#39;</span><span class="p">);</span>
  129. <span class="p">});</span>
  130. </pre></div>
  131. </div>
  132. </div></blockquote>
  133. </div>
  134. </div>
  135. <div class='related'>
  136. <h3>Navigation</h3>
  137. <ul>
  138. <li class="right" style="margin-right: 10px">
  139. <a href="../../../genindex.html" title="General Index"
  140. accesskey="I">index</a></li>
  141. <li class="right" >
  142. <a href="../../../py-modindex.html" title="Python Module Index"
  143. >modules</a> | </li>
  144. <li class="right" >
  145. <a href="demo4.html" title="textarea 延迟加载"
  146. accesskey="N">next</a> | </li>
  147. <li class="right" >
  148. <a href="demo2.html" title="DataLazyload 自动模式"
  149. accesskey="P">previous</a> | </li>
  150. <li><a href="../../../index.html">KISSY v1.2 Documentation</a> &#187; </li>
  151. <li><a href="../../index.html" >Demos</a> &#187; </li>
  152. <li><a href="../index.html" >Component</a> &#187; </li>
  153. <li><a href="index.html" accesskey="U">DataLazyload 使用示例</a> &#187; </li>
  154. </ul>
  155. </div>
  156. <div id="disqus_thread"></div>
  157. <script>
  158. if((window.location.hostname.indexOf("kissyui.com")!=-1 )&& window.localStorage.getItem("kissy-commment")!="0"){
  159. /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
  160. var disqus_shortname = 'kissy-docs'; // required: replace example with your forum shortname
  161. // The following are highly recommended additional parameters. Remove the slashes in front to use.
  162. //var disqus_identifier = '/anim';
  163. //var disqus_url = window.location;
  164. /* * * DON'T EDIT BELOW THIS LINE * * */
  165. (function() {
  166. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  167. dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
  168. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  169. })();
  170. }
  171. </script>
  172. <!--<div id="google-search-box">
  173. <div id="cse" style="width: 100%;">Loading</div>
  174. <script>
  175. if(window.location.hostname.indexOf("kissyui.com")!=-1){
  176. document.write('<script src="http://www.google.com/jsapi" type="text/javascript"><'+'/script>');
  177. }
  178. </script>
  179. <script>
  180. if(window.location.hostname.indexOf("kissyui.com")!=-1){
  181. google.load('search', '1', {language : 'zh-CN', style : google.loader.themes.MINIMALIST});
  182. google.setOnLoadCallback(function() {
  183. var customSearchControl = new google.search.CustomSearchControl('012347804910294994683:n4uzb24gqdm');
  184. customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
  185. customSearchControl.draw('cse');
  186. }, true);
  187. }
  188. </script>
  189. </div>-->
  190. </div>
  191. </div>
  192. <div class="col-sub"><ul class="s-box demo-toctree">
  193. <h2 class="s-box-hd">Seed</h2>
  194. <ul class="s-box-bd">
  195. <li><a href="../../seed/loader/index.html">loader</a></li>
  196. <li><a href="../../seed/lang/index.html">lang</a></li>
  197. <!--<li><a href="../../seed/kissy/index.html">kissy</a></li>
  198. <li><a href="../../seed/web/index.html">web</a></li>-->
  199. </ul>
  200. </ul>
  201. <ul class="s-box core-toctree">
  202. <h2 class="s-box-hd">Core</h2>
  203. <ul class="s-box-bd">
  204. <!--<li><a href="../../core/ua/index.html">ua</a></li>
  205. <li><a href="../../core/dom/index.html">DOM</a></li>
  206. <li><a href="../../core/event/index.html">event</a></li>
  207. <li><a href="../../core/node/index.html">node</a></li>
  208. <li><a href="../../core/json/index.html">json</a></li>
  209. <li><a href="../../core/ajax/index.html">ajax</a></li>
  210. <li><a href="../../core/cookie/index.html">cookie</a></li>
  211. <li><a href="../../core/base/index.html">base</a></li>-->
  212. <li><a href="../../core/anim/index.html">anim</a></li>
  213. </ul>
  214. </ul>
  215. <ul class="s-box component-toctree">
  216. <h2 class="s-box-hd">Component</h2>
  217. <ul class="s-box-bd">
  218. <li><a href="../mvc/index.html">mvc</a></li>
  219. <!--<li><a href="https://github.com/jquery/sizzle/wiki/Sizzle-Home">sizzle</a></li>
  220. <li><a href="../template/index.html">template</a></li>-->
  221. <li><a href="index.html">datalazyload</a></li>
  222. <!--<li><a href="../flash/index.html">flash</a></li>-->
  223. <li><a href="../dd/index.html">dd</a></li>
  224. <li><a href="../resizable/index.html">resizable</a></li>
  225. <li><a href="../switchable/index.html">switchable</a></li>
  226. <li><a href="../suggest/index.html">suggest</a></li>
  227. <li><a href="../calendar/index.html">calendar</a></li>
  228. <li><a href="../imagezoom/index.html">imagezoom</a></li>
  229. <li><a href="../overlay/index.html">overlay</a></li>
  230. <li><a href="../button/index.html">button</a></li>
  231. <li><a href="../menu/index.html">menu</a></li>
  232. <li><a href="../menubutton/index.html">menubutton</a></li>
  233. <li><a href="../tree/index.html">tree</a></li>
  234. <li><a href="../waterfall/index.html">waterfall</a></li>
  235. <li><a href="http://docs.kissyui.com/kissy/src/validation/demo/" target="_blank">validation</a></li>
  236. <li><a href="../editor/index.html">editor</a></li>
  237. </ul>
  238. </ul>
  239. </div>
  240. </div>
  241. </div>
  242. <div id="footer">
  243. &copy; Copyright 2010~2012, KISSY Team. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>
  244. </div>
  245. </body>
  246. </html>