欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
webkit-box & translate 的組合--流暢的滑動(dòng)體驗

如果說(shuō)從web Pages 能夠轉到web app時(shí)代,那么css3和html5其他相關(guān)技術(shù)一定是巨大的功臣。

唯一的遺憾就是pc端瀏覽器的泛濫導致了我們不得不走所謂的優(yōu)雅降級,而且這種降級是降到新技術(shù)幾乎木有多大的用武之地。
于是,客戶(hù)端還算統一的移動(dòng)端開(kāi)始成了一個(gè)大的試驗田。能夠讓眾人大肆的在上面舒展拳腳。諸如眾多新起的ui庫或者框架(jquery-mobile, sencha, phoneGap ...),可見(jiàn)在移動(dòng)終端上確實(shí)還有不小的田地??v使如此,效率仍舊成為一個(gè)最大的瓶頸。

之前有一種嘗試是用CSS3的transfrom或者animation給一個(gè)duration和ease的屬性來(lái)做動(dòng)畫(huà),這樣不管改變任何style樣式,都會(huì )根據這個(gè)ease有緩動(dòng)的效果。
例如:

/* webkit */
-webkit-transition-duration: 500ms;

在webkit內核瀏覽器下,只要有這個(gè)屬性,再去改變這個(gè)元素任何的樣式,它都會(huì )以一個(gè)默認的緩動(dòng)效果完成。

比如下面代碼:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<div id="test"></div>
<script>
Let('#test')
    .to(200, 200)
    .rotate(1000)
    .scale(.5)
    .set({
        'background-color': 'red',
        'width': 300
    })
    .duration(2000)
    .then()
        .set('opacity', .5)
        .set('height', 200)
        .duration('1s')
        .scale(1.5)
        .to(300, 300)
        .pop()
    .end()
     
</script>

這樣子有好處是可以針對所有的style樣式。所以可以用同樣的方式來(lái)對 left, top,margin-left,margin-top 之類(lèi)的css2 的style屬性來(lái)完成dom的相應變化。

但是,其實(shí),用transform或者animation來(lái)操作css2的style屬性。效率依然不高。在當前的移動(dòng)終端,ipad還ok(畢竟是喬幫主的產(chǎn)品),iphone和android pad上執行效率在大部分情況下很難達到優(yōu)秀app所要求的體驗。

所以要做滑動(dòng)之類(lèi)的改變dom位置的體驗。更好的實(shí)現應該是用純粹的translate來(lái)改變位置,為了更好的與之配合,布局就尤為重要。

下面看看webkit提供的 display:-webkit-box; 亦即

Flexible Box Module

我稱(chēng)其為【流體盒模型】
W3C草案(http://www.w3.org/TR/css3-flexbox/)的描述 如下:

 a CSS box model optimized for interface design. It provides an additional layout system alongside the ones already in CSS. [CSS21] In this new box model, the children of a box are laid out either horizontally or vertically, and unused space can be assigned to a particular child or distributed among the children by assignment of “flex” to the children that should expand. Nesting of these boxes (horizontal inside vertical, or vertical inside horizontal) can be used to build layouts in two dimensions. This model is based on the box model in the XUL user-interface language used for the user interface of many Mozilla-based applications (such as Firefox).

偶英文蹩腳,就不翻譯了,用另外一番話(huà)來(lái)看它的意思:

1.之前要實(shí)現橫列的web布局,通常就是float或者display:inline-block; 但是都不能做到真正的流體布局。至少width要自己去算百分比。
2.flexible box 就可以實(shí)現真正意義上的流體布局。只要給出相應屬性,瀏覽器會(huì )幫我們做額外的計算。

提供的關(guān)于盒模型的幾個(gè)屬性:

box-orient           子元素排列 vertical or horizontal
box-flex             兄弟元素之間比例,僅作一個(gè)系數
box-align            box 排列
box-direction        box 方向
box-flex-group       以組為單位的流體系數
box-lines           
box-ordinal-group    以組為單位的子元素排列方向
box-pack

以下是關(guān)于flexible box的幾個(gè)實(shí)例
三列自適應布局,且有固定margin

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<style>
.wrap {
    display: -webkit-box;
    -webkit-box-orient: horizontal;
}
.child {
    min-height: 200px;
    border: 2px solid #666;
    -webkit-box-flex: 1;
    margin: 10px;
    font-size: 100px;
    font-weight: bold;
    font-family: Georgia;
    -webkit-box-align: center;
}
</style>
 
<div class="wrap">
<div class="child">1</div>
<div class="child">2</div>
<div class="child">3</div>
</div>
</html>

 當一列定寬,其余兩列分配不同比例亦可(三列布局,一列定寬,其余兩列按1:2的比例自適應)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<meta charset="utf-8" />
<style>
.wrap {
    display: -webkit-box;
    -webkit-box-orient: horizontal;
}
.child {
    min-height: 200px;
    border: 2px solid #666;
    margin: 10px;
    font-size: 40px;
    font-weight: bold;
    font-family: Georgia;
    -webkit-box-align: center;
}
.w200 {width: 200px}
.flex1 {-webkit-box-flex: 1}
.flex2 {-webkit-box-flex: 2}
</style>
 
<div class="wrap">
<div class="child w200">200px</div>
<div class="child flex1">比例1</div>
<div class="child flex2">比例2</div>
</div>
</html>

  

 下面是一個(gè)常見(jiàn)的web page 的基本布局

<style>
header, footer, section {
    border: 10px solid #333;
    font-family: Georgia;
    font-size: 40px;
    text-align: center;
    margin: 10px;
}
#doc {
    width: 80%;
    min-width: 600px;
    height: 100%;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    margin: 0 auto;
}
header,
footer {
    min-height: 100px;
    -webkit-box-flex: 1;
}
#content {
    min-height: 400px;
    display: -webkit-box;
    -webkit-box-orient: horizontal;
}
 
.w200 {width: 200px}
.flex1 {-webkit-box-flex: 1}
.flex2 {-webkit-box-flex: 2}
.flex3 {-webkit-box-flex: 3}
</style>
 
<div id="doc">
    <header>Header</header>
    <div id="content">
        <section class="w200">定寬200</section>
        <section class="flex3">比例3</section>
        <section class="flex1">比例1</section>
    </div>
    <footer>Footer</footer>
</div>

  

 有了 flexible box 后,橫列布局的時(shí)候不用計算外圍容器和容器里面的元素的寬度。然后再進(jìn)行橫向的滑動(dòng)的效果就會(huì )省去不少麻煩。

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
W3C標準中對css3的transition屬性
優(yōu)美網(wǎng)站首頁(yè),頂部多層導航
手機頁(yè)面rem布局
5分鐘快速開(kāi)發(fā)之代碼生成器(asp.net mvc4 + easyui + knockoutjs)
discuz showWindow() 彈窗樣式
CSS flex
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久