zoukankan      html  css  js  c++  java
  • Js更简单的切换

    cshtml页面:

    <div class="htside_rt2">
    <div class="hmNewsBar">
    <div class="nxMenuGroup">
    <ul class="nxMenuZu">
    <li class="current"><a href="/news/Index" class="mu_rd" id="category_0">热 点</a>
    </li>
    <li><a href="/news/index?categoryIds=37" class="mu_xw" id="category_37">新闻</a> </li>
    <li><a href="/news/index?categoryIds=39" class="mu_hd" id="category_39">活动</a></li>
    <li><a href="/news/index?categoryIds=38" class="mu_gg" id="category_38">公告</a> </li>
    <div class="clear">
    </div>
    </ul>
    <a href="http://DXZ.niu99.com/News" id="new_more" class="more" style="float: right;
    margin-top: -25px; margin-right: 5px;">更多>></a>
    </div>
    <div class="nxNrshowGroup">
    <div class="nxListGroup">
    @{Html.RenderAction<PartController>(i => i.FontNews(7, 37, 38, 39));}
    </div>
    </div>
    <div class="nxNrshowGroup" style="display: none">
    <div class="nxListGroup">
    @{Html.RenderAction<PartController>(i => i.FontNews(7, 37));}
    </div>
    </div>
    <div class="nxNrshowGroup" style="display: none">
    <div class="nxListGroup">
    @{Html.RenderAction<PartController>(i => i.FontNews(7, 39));}
    </div>
    </div>
    <div class="nxNrshowGroup" style="display: none">
    <div class="nxListGroup">
    @{Html.RenderAction<PartController>(i => i.FontNews(7, 38));}
    </div>
    </div>
    </div>
    </div>
    <script type="text/javascript">
    $(function () {
    tabLi.init();
    })
    </script>

    Js页面:

    // 热点、新闻和游戏攻略等切换
    var tabLi = {

    init: function () {

    $(".nxMenuZu li").live("mouseover", function () {

    if ($(this).attr("class") === 'current') return;

    $(".nxMenuZu li.current").removeClass();
    $(this).removeClass().addClass("current");

    var i = $(this).index();

    $(".nxNrshowGroup:visible").hide();
    $(".nxNrshowGroup").eq(i).show();
    $("#new_more").attr("href",$(this).children("a").attr("href"));
    });
    },
    gameWarInit: function () {
    $(".yxglMenuZu li").live("mouseover", function () {
    if ($(this).find('a').attr("class") === 'on') return;

    $(".yxglMenuZu li a.on").removeClass().addClass("off");
    $(this).find('a').removeClass().addClass("on");

    var i = $(this).index();

    $(".gamegl_nrzu:visible").hide();
    $(".gamegl_nrzu").eq(i).show();

    });
    }

    }

  • 相关阅读:
    书签
    身份证查询
    Swiper 中文API手册(share)
    seo查询命令
    前端开发薪资之各地区对比(图文分析)(share)
    新浪微博AppKey大集合(share)
    PHP乱码问题,UTF-8(乱码) (share)
    JavaScript 获取数组中最大值、最小值
    设为首页 添加到收藏夹 (share)
    javascript数组 去重
  • 原文地址:https://www.cnblogs.com/douqiumiao/p/2813295.html
Copyright © 2011-2022 走看看