網頁resizable 布局

來源:互聯網
上載者:User

標籤:js   布局   css   html   

resizable 布局

開發案頭應用時,應用一般會有多個窗格,這些窗格需要可調節寬度高度,使用node-webkit開發,布局就是網頁布局,這時候這就需要resize的屬性,實際效果如:http://jsfiddle.net/

可以使用jquery.ui 的 resizable 屬性

Css布局方面,最外層的parent div設定為相對定位,內部的child div 設定為絕對位置

以一個左右兩欄布局為例,代碼如下,實際效果頁面:http://jsfiddle.net/7vn4j5rz/

由於js代碼被csdn過濾了,可以在http://lufeng.me/post/resizable-layout-copy查看原文

<!DOCTYPE html><html>    <head></head>    <body>        <div class="parent">            <div class="leftChlid column">                This is left window            </div>            <div class="rightChild column">                This is right window            </div>        </div>    </body></html>
css:
$(function() {      $(‘.rightChild‘).width($(‘.parent‘).width() - $(‘.leftChild‘).width() - 20);    $(".leftChild" ).resizable({        handles: ‘e‘,         // 設定resize的方向 North, Sourth, West, East        maxWidth: 450,        minWidth: 100    });    $(‘.leftChild‘).resize(function() {        $(‘.rightChild‘).width($(‘.parent‘).width() - $(‘.leftChild‘).width() - 20);    });})

網頁resizable 布局

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.