网络浏览器: Difference between revisions

T (talk | contribs)
T (talk | contribs)
Line 108: Line 108:
你可以在两个屏幕中查看一个页面。操作时,下屏是可以操作的,而上屏随之滚动。这样在CSS计算样式时,在220px而不是432px的范围内,元素从下往上定位。
你可以在两个屏幕中查看一个页面。操作时,下屏是可以操作的,而上屏随之滚动。这样在CSS计算样式时,在220px而不是432px的范围内,元素从下往上定位。


== Using Both Screens ==
== 使用双屏 ==


Generally the easiest way to accomplish the correct layout is to create HTML elements that "contain" the top and bottom screens. Here's an example:
通常最简单的正确布局是创建包含双屏的HTML元素,比如这样:


  <!DOCTYPE html>
  <!DOCTYPE html>
Line 123: Line 123:
   </head>
   </head>
   <body>
   <body>
     &lt;div id="topscreen">Top Screen&lt;/div>
     &lt;div id="topscreen">上屏&lt;/div>
     &lt;div id="bottomscreen">Bottom Screen&lt;/div>
     &lt;div id="bottomscreen">下屏&lt;/div>
   </body>
   </body>
  </html>
  </html>


This scheme allows the page to be easily manipulated through JavaScript.  In order to have the window snap to the correct position, use the following JavaScript code:
使用这种方法很容易通过JavaScript操作页面。为了让窗口获得正确的位置,可以使用下面的JavaScript代码:


  window.setInterval(function () {
  window.setInterval(function () {
Line 134: Line 134:
  }, 50);
  }, 50);


This automatically resets the position if the user accidentally scrolls the page.
这样如果用户不小心滚动了页面,页面能够自动复位。


==Example Sites==
==Example Sites==