jQuery EasyUI 布局

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   os   使用   ar   sp   

通過使用 jQuery EasyUI 可以很容易地添加 Tabs。您只需要調用 ‘add‘ 方法即可。

在本教程中,我們將使用 iframe 動態地添加顯示在一個頁面上的 Tabs。 當點擊添加按鈕,一個新的 tab 將被添加。如果 tab 已經存在,它將被啟用。

步驟 1:建立 Tabs
<div style="margin-bottom:10px">    <a href="#" class="easyui-linkbutton" onclick="addTab(‘google‘,‘http://www.google.com‘)">google</a>    <a href="#" class="easyui-linkbutton" onclick="addTab(‘jquery‘,‘http://jquery.com/‘)">jquery</a>        <a href="#" class="easyui-linkbutton" onclick="addTab(‘easyui‘,‘http://jeasyui.com/‘)">easyui</a></div><div id="tt" class="easyui-tabs" style="width:400px;height:250px;"><div title="Home"></div></div>

這個 html 代碼非常簡單,我們建立了帶有一個名為 ‘Home‘ 的 tab 面板的 Tabs。請注意,我們不需要寫任何的 js 代碼。

步驟 2:實現 ‘addTab‘ 函數
function addTab(title, url){        if ($(‘#tt‘).tabs(‘exists‘, title)){            $(‘#tt‘).tabs(‘select‘, title);        } else {            var content = ‘<iframe scrolling="auto" frameborder="0"  src="‘+url+‘" style="width:100%;height:100%;"></iframe>‘;            $(‘#tt‘).tabs(‘add‘,{                title:title,                content:content,                closable:true            });        }    }

jQuery EasyUI 布局

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.