MVC+EasyUI+三層新聞網(wǎng)站建立 tabs標(biāo)簽制作方法(六)
MVC新聞網(wǎng)站建立,完成tabs標(biāo)簽的制作。
首先對(duì) Center 進(jìn)行一個(gè)簡(jiǎn)單的布局
<!--------------中間布局開始----------------> <div data-options="region:'center',title:'Center'" > <div class="easyui-tabs" style="width:700px;height:250px" fit="true" id="tt"> <div title="歡迎使用"> <h1 style="font-size: 24px;">歡迎!</h1> <h1 style="font-size: 24px; color:red;"> Welcome !</h1> </div> </div> </div> <!--------------中間布局結(jié)束--------------->
然后就是在js里面完成tabs的點(diǎn)擊事件實(shí)現(xiàn)了
其實(shí)center就是在div里面嵌入了一個(gè)iframe,所以最后返回的就是一個(gè)iframe
<script type="text/javascript"> $(function () { //tabs的點(diǎn)擊事件 bindTabsEvent(); }); function bindTabsEvent() { $(".detail").click(function () { //拿到點(diǎn)擊標(biāo)題 var title = $(this).text(); //拿到點(diǎn)擊的url var url = $(this).attr("url"); //判斷標(biāo)簽是否存在 var isExt = $("#tt").tabs("exists", title); //如果存在則選中 if (isExt) { $("#tt").tabs("select", title); //選中 return; } //不存在就添加標(biāo)簽 $("#tt").tabs("add", { title: title, content: createTabContent(url), closable:true }); }); } function createTabContent(url) { return '<iframe src="' + url + '" scrolling="no" frameborder="0" width="100%" height="100%"></iframe>'; } </script>
這里需要注意一點(diǎn)就是上面的detail是導(dǎo)航欄的類選擇器的值(這里的class一定要一樣)
整個(gè)頁面代碼
@{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> <script src="~/Scripts/jquery-1.8.2.js"></script> <script src="~/Content/EasyUI/jquery.easyui.min.js"></script> <script src="~/Content/EasyUI/easyui-lang-zh_CN.js"></script> <link href="~/Content/EasyUI/themes/default/easyui.css" rel="external nofollow" rel="stylesheet" /> <link href="~/Content/EasyUI/themes/icon.css" rel="external nofollow" rel="stylesheet" /> <script type="text/javascript"> $(function () { //tabs的點(diǎn)擊事件 bindTabsEvent(); }); function bindTabsEvent() { $(".detail").click(function () { //拿到點(diǎn)擊標(biāo)題 var title = $(this).text(); //拿到點(diǎn)擊的url var url = $(this).attr("url"); //判斷標(biāo)簽是否存在 var isExt = $("#tt").tabs("exists", title); //如果存在則選中 if (isExt) { $("#tt").tabs("select", title); //選中 return; } //不存在就添加標(biāo)簽 $("#tt").tabs("add", { title: title, content: createTabContent(url), closable:true }); }); } function createTabContent(url) { return '<iframe src="' + url + '" scrolling="no" frameborder="0" width="100%" height="100%"></iframe>'; } </script> </head> <body class="easyui-layout"> <div data-options="region:'north',border:false" style="height:60px;background:#B3DFDA;padding:10px">north region</div> <!---------左側(cè)布局------------------------------------> <div data-options="region:'west',split:true,title:'West'" style="width:150px;padding:0px;"> <div class="easyui-accordion" style="width:auto;height:auto;"> <div title="新聞管理" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;"> <a href="javascript:void(0)" rel="external nofollow" rel="external nofollow" class="detail" url="/AdminNewInfo/Index">新聞管理</a> </div> <div title="評(píng)論管理" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;"> <a href="javascript:void(0)" rel="external nofollow" rel="external nofollow" class="detail" url="/CommentInfo/Index">評(píng)論管理</a> </div> </div> </div> <!---------左側(cè)布局結(jié)束------------------------------------> <div data-options="region:'south',border:false" style="height:30px;background:#A9FACD;padding:10px;">south region</div> <!--------------中間布局開始----------------> <div data-options="region:'center',title:'Center'" > <div class="easyui-tabs" style="width:700px;height:250px" fit="true" id="tt"> <div title="歡迎使用"> <h1 style="font-size: 24px;">歡迎!</h1> <h1 style="font-size: 24px; color:red;"> Welcome !</h1> </div> </div> </div> <!--------------中間布局結(jié)束---------------> </body> </html>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
.NET Core API CORS的實(shí)現(xiàn)
這篇文章主要介紹了.NET Core API CORS的實(shí)現(xiàn),小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-08-08SQL Server數(shù)據(jù)庫連接 Web.config如何配置
以下的文章主要描述的是Web.config正確配置SQL Server數(shù)據(jù)庫連接的實(shí)際擦步驟。我們以圖文結(jié)合的方式對(duì)其有個(gè)更好的說明,需要的朋友可以參考下2015-10-10ASP.NET?Core中的策略授權(quán)和ABP授權(quán)
這篇文章介紹了ASP.NET?Core中的策略授權(quán)和ABP授權(quán),文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-02-02Asp.net內(nèi)置對(duì)象之Request對(duì)象(概述及應(yīng)用)
Request對(duì)象主要用于獲取來自客戶端的數(shù)據(jù),如用戶填入表單的數(shù)據(jù)、保存在客戶端的Cookie等,本文將圍繞Request對(duì)象,講解其的主要作用:讀取窗體變量、讀取查詢字符串變量、取得Web服務(wù)器端的系統(tǒng)信息。取得客戶端瀏覽器信息等等,感興趣的朋友可以了解下2013-02-02關(guān)于.NET Framework中的設(shè)計(jì)模式--應(yīng)用策略模式為L(zhǎng)ist排序
本篇文章,小編將為大家介紹關(guān)于.NET Framework中的設(shè)計(jì)模式--應(yīng)用策略模式為L(zhǎng)ist排序,有需要的朋友可以參考一下2013-04-04ASP.NET中application對(duì)象的使用介紹
這篇文章主要介紹了ASP.NET中application對(duì)象的使用,需要的朋友可以參考下2014-04-04visual studio 2015+opencv2.4.13配置教程
這篇文章主要為大家詳細(xì)介紹了visual studio 2015+opencv2.4.13配置教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-11-11asp.net 繼承自Page實(shí)現(xiàn)統(tǒng)一頁面驗(yàn)證與錯(cuò)誤處理
一直以來,我都在思考以前一個(gè)項(xiàng)目中,后臺(tái)文件中很多的.aspx文件上的權(quán)限判斷問題,傻乎乎的我基本上每個(gè)文件當(dāng)時(shí)都給加了一句2009-04-04