PageRenderTime 66ms CodeModel.GetById 35ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/html/api/core/node/width.html

https://github.com/YuhangGe/kissyteam.github.com
HTML | 256 lines | 215 code | 22 blank | 19 comment | 0 complexity | 5fbbbfaf24cdbd291d09133e24a9ff33 MD5 | raw file
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>width &mdash; KISSY Docs valpha documentation</title>
  6. <link rel="stylesheet" href="../../../static/reset.css"/>
  7. <link rel="stylesheet" href="../../../static/kissy.css"/>
  8. <link rel="stylesheet" href="../../../static/pygments.css"/>
  9. <link rel="shortcut icon" href="../../../static/favicon.ico"/>
  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: 'alpha',
  15. COLLAPSE_INDEX: false,
  16. FILE_SUFFIX: '.html',
  17. HAS_SOURCE: true
  18. };
  19. if(window.location.href.indexOf("localhost/kissy_git/")!=-1){
  20. document.write('<script src="http://localhost/kissy_git/kissy/build/kissy.js"'+'><'+'/script>');
  21. } else{
  22. document.write('<script src="http://yiminghe.github.com/kissy/build/kissy.js"'+'>'+'<'+'/script>');
  23. }
  24. </script>
  25. <script type="text/javascript" src="../../../static/jquery.js"></script>
  26. <script type="text/javascript" src="../../../static/underscore.js"></script>
  27. <script type="text/javascript" src="../../../static/doctools.js"></script>
  28. </head>
  29. <body><div id="header">
  30. <h1 class="logo"><a alt="KISSY" href="http://docs.kissyui.com"><img src="../../../static/logo.png"/></a></h1>
  31. <p class="desc">小巧灵活简洁实用愉悦编码快乐开发</p>
  32. <ul class="navigation">
  33. <li><a href="../../../../html/quickstart/index.html">快速上手</a></li>
  34. <li><a href="../../../../html/api/index.html">API</a></li>
  35. <li><a href="../../../../html/demo/index.html">DEMO</a></li>
  36. <li><a href="http://blog.kissyui.com/">博客</a></li>
  37. <!--<li><a href="mailto:all@kissyui.com">论坛</a></li>-->
  38. <li><a href="http://www.github.com/kissyteam">源码</a></li>
  39. </ul>
  40. <div id="searchbox" style="display: none" class="searchbox">
  41. <form class="search" action="../../../search.html" method="get">
  42. <input type="text" name="q" size="28" class="ipt"/>
  43. <input type="submit" value="Go" class="btn"/>
  44. <input type="hidden" name="check_keywords" value="yes" />
  45. <input type="hidden" name="area" value="default" />
  46. </form>
  47. </div>
  48. <script type="text/javascript">$('#searchbox').show(0);</script>
  49. </div>
  50. <div id="content">
  51. <div class="layout grid-s6m0">
  52. <div class="col-main">
  53. <div class="main-wrap">
  54. <div class='related'>
  55. <h3>Navigation</h3>
  56. <ul>
  57. <li class="right" style="margin-right: 10px">
  58. <a href="../../../genindex.html" title="General Index"
  59. accesskey="I">index</a></li>
  60. <li class="right" >
  61. <a href="../../../py-modindex.html" title="Python Module Index"
  62. >modules</a> | </li>
  63. <li class="right" >
  64. <a href="addStyleSheet.html" title="addStyleSheet"
  65. accesskey="N">next</a> | </li>
  66. <li class="right" >
  67. <a href="height.html" title="height"
  68. accesskey="P">previous</a> | </li>
  69. <li><a href="../../../index.html">KISSY Docs</a> &#187; </li>
  70. <li><a href="../../index.html" >API文档</a> &#187; </li>
  71. <li><a href="../index.html" >Core</a> &#187; </li>
  72. <li><a href="index.html" accesskey="U">Node</a> &#187; </li>
  73. </ul>
  74. </div>
  75. <div class="section" id="width">
  76. <h1>width<a class="headerlink" href="#width" title="Permalink to this headline"></a></h1>
  77. <div class="section" id="module">
  78. <h2>Module<a class="headerlink" href="#module" title="Permalink to this headline"></a></h2>
  79. <blockquote>
  80. <div><a class="reference internal" href="index.html#module-Node" title="Node"><tt class="xref py py-mod docutils literal"><span class="pre">Node</span></tt></a></div></blockquote>
  81. </div>
  82. <div class="section" id="methods">
  83. <h2>Methods<a class="headerlink" href="#methods" title="Permalink to this headline"></a></h2>
  84. <dl class="method">
  85. <dt id="Node.NodeList.width">
  86. <tt class="descclassname">NodeList.</tt><tt class="descname">width</tt><big>(</big><big>)</big><a class="headerlink" href="#Node.NodeList.width" title="Permalink to this definition"></a></dt>
  87. <dd><div class="line-block">
  88. <div class="line">NodeList <strong>width</strong> ()</div>
  89. <div class="line">得到当前节点列表第一个节点的计算宽度</div>
  90. </div>
  91. <table class="docutils field-list" frame="void" rules="none">
  92. <col class="field-name" />
  93. <col class="field-body" />
  94. <tbody valign="top">
  95. <tr class="field"><th class="field-name" colspan="2">Return type:</th></tr>
  96. <tr><td>&nbsp;</td><td class="field-body">number</td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. <p> <tt class="docutils literal"><span class="pre">css('width')</span></tt> 的区别在于该函数返回不带单位的纯数值, 而前者则返回带单位的原始值(例如 <tt class="docutils literal"><span class="pre">400px</span></tt> ).
  101. 当需要数值计算时, 推荐该方法.</p>
  102. <p class="versionadded">
  103. <span class="versionmodified">New in version 1.2: </span>该方法也可以用来得到 windw document 的宽度</p>
  104. <div class="highlight-javascript"><div class="highlight"><pre><span class="nx">KISSY</span><span class="p">.</span><span class="nx">use</span><span class="p">(</span><span class="s2">&quot;node&quot;</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">Node</span><span class="p">){</span>
  105. <span class="nx">Node</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="nb">window</span><span class="p">).</span><span class="nx">width</span><span class="p">();</span> <span class="c1">// 得到浏览器可以区域的高度, 相当于 DOM.viewportWidth()</span>
  106. <span class="nx">Node</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">width</span><span class="p">();</span> <span class="c1">//得到 html 文档的高度, 相当于 DOM.docWidth()</span>
  107. <span class="p">});</span>
  108. </pre></div>
  109. </div>
  110. <div class="line-block">
  111. <div class="line">NodeList <strong>width</strong> ( value )</div>
  112. <div class="line">设置当前列表每个元素的 css width .</div>
  113. </div>
  114. <table class="docutils field-list" frame="void" rules="none">
  115. <col class="field-name" />
  116. <col class="field-body" />
  117. <tbody valign="top">
  118. <tr class="field"><th class="field-name" colspan="2">Parameters:</th></tr>
  119. <tr><td>&nbsp;</td><td class="field-body"><strong>value</strong> (<em>number|string</em>) &#8211; 代表像素的整数值, 或数字加上其他单位的字符串值.</td>
  120. </tr>
  121. </tbody>
  122. </table>
  123. <div class="admonition note">
  124. <p class="first admonition-title">Note</p>
  125. <p class="last">在现代浏览器中, css width 属性不包括 padding , border 或者 margin.</p>
  126. </div>
  127. <p>例子可参考 <tt class="xref py py-meth docutils literal"><span class="pre">height()</span></tt></p>
  128. </dd></dl>
  129. </div>
  130. </div>
  131. <div>
  132. <label>
  133. 评论
  134. <select id='openComment'>
  135. <option value='1'>打开</option>
  136. <option value='0'>关闭</option>
  137. </select>
  138. </label>
  139. <script>
  140. if(!window.localStorage){
  141. KISSY.one("#openComment").attr("disabled",true);
  142. }else{
  143. KISSY.one("#openComment").val(window.localStorage.getItem("kissy-commment")||"1");
  144. KISSY.one("#openComment").on("change",function(){
  145. window.localStorage.setItem("kissy-commment",KISSY.one("#openComment").val());
  146. window.location.reload();
  147. });
  148. }
  149. </script>
  150. </div>
  151. <div id="disqus_thread"></div>
  152. <script>
  153. if((window.location.hostname.indexOf("kissyui.com")!=-1 )&& window.localStorage.getItem("kissy-commment")!="0"){
  154. /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
  155. var disqus_shortname = 'kissy-docs'; // required: replace example with your forum shortname
  156. // The following are highly recommended additional parameters. Remove the slashes in front to use.
  157. //var disqus_identifier = '/anim';
  158. //var disqus_url = window.location;
  159. /* * * DON'T EDIT BELOW THIS LINE * * */
  160. (function() {
  161. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  162. dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
  163. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  164. })();
  165. }
  166. </script>
  167. <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  168. <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
  169. <!--<div id="google-search-box">
  170. <div id="cse" style="width: 100%;">Loading</div>
  171. <script>
  172. if(window.location.hostname.indexOf("kissyui.com")!=-1){
  173. document.write('<script src="http://www.google.com/jsapi" type="text/javascript"><'+'/script>');
  174. }
  175. </script>
  176. <script>
  177. if(window.location.hostname.indexOf("kissyui.com")!=-1){
  178. google.load('search', '1', {language : 'zh-CN', style : google.loader.themes.MINIMALIST});
  179. google.setOnLoadCallback(function() {
  180. var customSearchControl = new google.search.CustomSearchControl('012347804910294994683:n4uzb24gqdm');
  181. customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
  182. customSearchControl.draw('cse');
  183. }, true);
  184. }
  185. </script>
  186. </div>-->
  187. </div>
  188. </div>
  189. <div class="col-sub"><ul class="s-box api-toctree">
  190. <h2 class="s-box-hd">Seed</h2>
  191. <ul class="s-box-bd">
  192. <li><a href="../../seed/loader/index.html">Loader</a></li>
  193. <li><a href="../../seed/kissy/index.html">kissy</a></li>
  194. <li><a href="../../seed/lang/index.html">lang</a></li>
  195. <li><a href="../../seed/web/index.html">web</a></li>
  196. </ul>
  197. </ul>
  198. <ul class="s-box core-toctree">
  199. <h2 class="s-box-hd">Core</h2>
  200. <ul class="s-box-bd">
  201. <li><a href="../ua/index.html">ua</a></li>
  202. <li><a href="../dom/index.html">DOM</a></li>
  203. <li><a href="../event/index.html">event</a></li>
  204. <li><a href="index.html">node</a></li>
  205. <li><a href="../json/index.html">json</a></li>
  206. <li><a href="../ajax/index.html">ajax</a></li>
  207. <li><a href="../cookie/index.html">cookie</a></li>
  208. <li><a href="../base/index.html">base</a></li>
  209. <li><a href="../anim/index.html">anim</a></li>
  210. </ul>
  211. </ul>
  212. <ul class="s-box component-toctree">
  213. <h2 class="s-box-hd">Component</h2>
  214. <ul class="s-box-bd">
  215. <li><a href="https://github.com/jquery/sizzle/wiki/Sizzle-Home">sizzle</a></li>
  216. <li><a href="../../component/template/index.html">template</a></li>
  217. <li><a href="../../component/datalazyload/index.html">datalazyload</a></li>
  218. <li><a href="../../component/flash/index.html">flash</a></li>
  219. <li><a href="../../component/dd/index.html">dd</a></li>
  220. <li><a href="../../component/switchable/index.html">switchable</a></li>
  221. <li><a href="../../component/suggest/index.html">suggest</a></li>
  222. <li><a href="../../component/calendar/index.html">calendar</a></li>
  223. <li><a href="../../component/imagezoom/index.html">imagezoom</a></li>
  224. <li><a href="../../component/overlay/index.html">overlay</a></li>
  225. </ul>
  226. </ul>
  227. </div>
  228. </div>
  229. </div>
  230. <div id="footer">
  231. &copy; Copyright 2010~2011, KISSY Team. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>
  232. </div>
  233. </body>
  234. </html>