欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MVC+EasyUI+三層新聞網(wǎng)站建立 tabs標(biāo)簽制作方法(六)

 更新時(shí)間:2017年07月10日 16:30:50   作者:劉指導(dǎo)  
這篇文章主要為大家詳細(xì)介紹了MVC+EasyUI+三層新聞網(wǎng)站建立的第六篇,教大家如何制作tabs標(biāo)簽,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

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)文章

最新評(píng)論