zoukankan      html  css  js  c++  java
  • JQuery------实现鼠标点击和滑动不同效果

    如图:

    代码:

    html

    <ul class="price-brand-right">
      @foreach (Brand item in ViewBag.Brand)
      {
        <li class="li-brand" style="cursor:pointer;">@item.name<input type="hidden" value="@item.brandid"></li>
      }
    </ul>

    js

    //品牌鼠标移动
    $(".li-brand").hover(function () {
      var b = $(this).css("fontWeight");
      if (b.indexOf("bold") != -1) {
        return false;
      }
      $(this).css({ "color": "red", "text-decoration": "underline" });
    }, function () {
      var b = $(this).css("fontWeight");
      if (b.indexOf("bold") != -1) {
        return false;
      }
      $(this).css({ "color": "#666", "text-decoration": "none" });
    });
    
    //品牌点击
    $(".li-brand").click(function () {
      $(this).css({ "color": "green", "fontWeight": "bold", "text-decoration": "none" });
      $(this).prevAll("li").css({ "color": "#666", "fontWeight": "normal" });
      $(this).nextAll("li").css({ "color": "#666", "fontWeight": "normal" });
    });
  • 相关阅读:
    Linux系统之-TCP-IP链路层
    TCP-IP协议简介
    一些概念
    Bolzano-Weierstrass 定理
    Newton 插值法
    用 Ipe 画图
    Codeforces #677D Vanya and Treasure
    Codeforces #990E Post Lamp
    hihoCoder #1763 道路摧毁
    hihoCoder #1758 加减
  • 原文地址:https://www.cnblogs.com/tianhengblogs/p/6386907.html
Copyright © 2011-2022 走看看