jquery Tab切换,CSS3制作发光字

news/2024/7/11 1:08:48 标签: jquery, css3, 前端

jquery_TabCSS3_0">jquery Tab切换,CSS3制作发光字

在这里插入图片描述

代码如下

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Tab</title>
  <style>
    * {
      margin: 0;
      padding: 0
    }

    ul {
      list-style: none;
    }

    .container {
      margin: 10px auto;
      width: 300px;
      height: 500px;
      border: 2px solid #e7e7e7;
      border-radius: 10px;
    }

    .container h4 {
      text-align: center;
      height: 50px;
      line-height: 50px;
      font-size: 24px;
      background-color: #909399;
      color: #FFF;
      border-top-right-radius: 8px;
      border-top-left-radius: 8px;

      letter-spacing: 24px;
      padding-left: 16px;

      /* font: bold 24px "Microsoft YaHei"; */
      text-shadow: 1px 1px rgba(197, 223, 248, 0.8),
        2px 2px rgba(197, 223, 248, 0.8),
        3px 3px rgba(197, 223, 248, 0.8),
        4px 4px rgba(197, 223, 248, 0.8),
        5px 5px rgba(197, 223, 248, 0.8),
        6px 6px rgba(197, 223, 248, 0.8);
    }

    /* tab */
    #coupon {
      border-top: 2px solid #e7e7e7;
      height: 26px;
      border-bottom: 2px solid #e7e7e7;
    }

    #coupon>li {
      float: left;
      display: inline-block;
      width: 100px;
      height: 30px;
      line-height: 30px;
      font-size: 14px;
      color: rgb(177, 175, 175);
      box-sizing: border-box;
      text-align: center;
      cursor: pointer;
      margin-top: -2px;
      margin-bottom: -2px;
    }

    #coupon>li:first-child {
      border-left: 0;
      border-right: 0;
    }

    #coupon>li:last-child {
      border-left: 0;
      border-right: 0;
    }

    #coupon .active {
      border: none;
      background: #409eff;
      border-radius: 2px;
      color: #fff;
    }

    /* 优惠券内容 */
    #coupon-contain {
      margin: 10px 5px;
    }

    #coupon-contain>div>div {
      margin: 10px 5px;
      text-align: center;
      height: 40px;
      line-height: 40px;
      border-radius: 8px;
      background: #f56c6c;
      color: #fff;
      font-size: 14px;
    }

    /* 隐藏所有优惠券 */
    #coupon-contain>div {
      display: none;
    }

    /* 显示class为show的元素 */
    #coupon-contain>.show {
      display: block;
    }

    #coupon-contain>div:first-child>div {
      background: #67c23a;
    }

    #coupon-contain>div:last-child>div {
      background: #909399;
    }
  </style>

  <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>
  <script>
    $(function () {
      var $coupon_tab = $("#coupon>li");
      var $coupon_contain = $('#coupon-contain>div');
      var index = 0;

      $coupon_tab.click(function () {
        // 移除tab中class的active属性
        $($coupon_tab[index]).removeClass('active');
        // 移除优惠券中class的active属性
        $($coupon_contain[index]).removeClass('show');
        index = $(this).index();
        // 添加tab中class的active属性
        $(this).addClass('active');
        // 添加优惠券中class的active属性
        $($coupon_contain[index]).addClass('show');
      });
    });
  </script>
</head>

<body>
  <div class="container">
    <h4>优惠券</h4>
    <ul id="coupon">
      <li class="active">未使用</li>
      <li>已使用</li>
      <li>已过期</li>
    </ul>
    <div id="coupon-contain">
      <div id=“coupon-unused” class="show">
        <div>未使用的优惠券</div>
        <div>未使用的优惠券</div>
        <div>未使用的优惠券</div>
      </div>
      <div id=“coupon-used” class="hide">
        <div>已使用的优惠券</div>
        <div>已使用的优惠券</div>
        <div>已使用的优惠券</div>
      </div>
      <div id=“coupon-expired” class="hide">
        <div>已过期的优惠券</div>
        <div>已过期的优惠券</div>
        <div>已过期的优惠券</div>
      </div>
    </div>
  </div>
</body>

</html>

http://www.niftyadmin.cn/n/5289003.html

相关文章

Day01-Ajax

一.JSON方法 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document</title> </head>…

【RocketMQ笔记02】安装RocketMQ可视化工具rocketmq-dashboard

这篇文章&#xff0c;主要介绍如何安装RocketMQ可视化工具rocketmq-dashboard。 目录 一、RocketMQ可视化界面 1.1、下载rocketmq-dashboard 1.2、修改配置文件 1.3、打包工程 1.4、启动rocketmq-dashboard 一、RocketMQ可视化界面 1.1、下载rocketmq-dashboard rocketm…

分享好用的chatgpt

1.在vscode中&#xff0c;点击这个&#xff1a; 2.搜索&#xff1a;ChatGPT - 中文版&#xff0c;个人觉得这个更好用&#xff1a; 3.下载完成之后&#xff0c;左侧会多出来这个&#xff1a; 点击这个图标就能进入chatgpt界面了 4.如果想使用tizi访问国外的chatgpt&#xf…

C#/WPF JSON序列化和反序列化

什么是json json是存储和交换文本信息的方法&#xff0c;类似xml。但是json比xml更小&#xff0c;更快&#xff0c;更易于解析。并且json采用完全独立于语言的文本格式(即不依赖于各种编程语言)&#xff0c;这些特性使json成为理想的数据交换语言。json序列化是指将对象转换成j…

Maven之插件入门

官方文档&#xff1a;https://maven.apache.org/guides/plugin/guide-java-plugin-development.html 命名规范 <yourplugin>-maven-plugin 创建项目 生成项目 方式一、IDEA 2023 方式二、命令行 mvn archetype:generate -DgroupIdcn.lsj -DartifactIdhello-maven-pl…

Swift学习笔记第三节:Set类型

1、代码 import Foundationvar set1: Set<Int> [1, 2, 3, 4, 3] print("定义1: \(set1)") var set2 Set(1...4) print("定义2: \(set2)") print("长度: \(set2.count)") print("是否为空: \(set2.isEmpty)") set1.insert(99)…

基层医疗卫生信息可视化:Flask、MySQL、Echarts的综合利用

基层医疗卫生信息可视化&#xff1a;Flask、MySQL、Echarts的综合利用 正文&#xff1a; 社区卫生健康数据可视化是提升医疗服务水平和促进健康管理的有效手段。本文将介绍一种基于Flask、MySQL和Echarts技术的社区卫生健康数据可视化系统&#xff0c;数据源来自市基层医疗卫生…

解决Pycharm pip安装模块太慢问题,pycharm2022没有manage repositories配置镜像源

解决方案 方法清华阿里云中国科技大学华中理工大学 或者直接-i 加镜像 方法 URL写下面任意一个 清华 https://pypi.tuna.tsinghua.edu.cn/simple阿里云 http://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/华中理工大学 http:/…