<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>网页选项卡应用</title>
<script type="text/javascript"
src="Jscript/jquery-1.8.2.min.js">
</script>
<style type="text/css">
body{font-size:13px}
ul,li {margin:0;padding:0;list-style:none}
#menu li {text-align:center;float:left;padding:5px;
margin-right:2px;width:50px;cursor:pointer}
#menu li.tabFocus {width:50px; font-weight:bold;
background-color:#f3f2e7;border:solid 1px #666;
border-bottom:0;z-index:100;position:relative}
#content {width:260px;height:80px;padding:10px;
background-color:#f3f2e7;clear:left;
border:solid 1px #666;position:relative;top:-1px}
#content li{display:none}
#content li.conFocus{display:block}
</style>
<script type="text/javascript">
$(function() {
$("#menu li").each(function(index) { //带参数遍历各个选项卡
$(this).click(function() { //注册每个选卡的单击事件
$("#menu li.tabFocus").removeClass("tabFocus"); //移除已选中的样式
$(this).addClass("tabFocus"); //增加当前选中项的样式
//显示选项卡对应的内容并隐藏未被选中的内容
$("#content li:eq(" + index + ")").show()
.siblings().hide();
});
});
})
</script>
</head>
<body>
<ul id="menu">
<li class="tabFocus">家居</li>
<li>电器</li>
<li>二手</li>
</ul>
<ul id="content">
<li class="conFocus">我是家居的内容</li>
<li>欢迎您来到电器城</li>
<li>二手市场,产品丰富多彩</li>
</ul>
</body>
</html>

jQuery-切换2的更多相关文章

  1. jQuery切换网页皮肤保存到Cookie实例

    效果体验:http://keleyi.com/keleyi/phtml/jqtexiao/25.htm 以下是源代码: <!DOCTYPE html PUBLIC "-//W3C//D ...

  2. jquery切换tab标签例子

    之前做了一个简单的小效果,使用jquery方式,让tab标签切换,效果如下 代码其实很简单,首先先把代码分享给大家,代码如下 var shoptoggle = $('.shoptoggle .shop ...

  3. jQuery切换网页皮肤并保存到Cookie示例代码

    经过使用,靠谱! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww ...

  4. jQuery切换事件

    有html页面内容如下: <body> <h5 id="hh">关于jQuery的介绍</h5> <p id="p1" ...

  5. jquery切换

    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> < ...

  6. jQuery 切换图片(图标)效果

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. jQuery——切换toggle

    toggle()-----显示隐藏 toggleClass-------添加类或者删除类 <!DOCTYPE html> <html lang="en"> ...

  8. jquery切换class

    <ul class="nva_sele_txt" id="">            <a href="#" class= ...

  9. jQuery实现的鼠标滑过切换图片代码实例

    jQuery实现的鼠标滑过切换图片代码实例:有时候网页需要这样的简单效果,那就是当鼠标滑过默认图片的时候,能够实现图片的切换,可能在实际应用中,往往没有这么简单,不过大家可以自行扩展一下,下面简单介绍 ...

  10. 10 款基于 jQuery 的切换效果插件推荐

    本文整理了 10 款非常好用的 jQuery 切换效果插件,包括平滑切换和重叠动画等,这些插件可以实现不同元素之间的动态切换. 1. InnerFade 这是一个基于 jQuery 的小插件,可以实现 ...

随机推荐

  1. Exception 07 : org.hibernate.LazyInitializationException: could not initialize proxy - no Session

    异常名称: org.hibernate.LazyInitializationException: could not initialize proxy - no Session 异常截图: 异常详情: ...

  2. 从urllib2的内存泄露看python的GC python引用计数 对象的引用数 循环引用

    这里会发现上述代码是存在内存泄露,造成的原因就是lz与ow这两个变量存在循环引用,Python 不知道按照什么样的安全次序来调用对象的 __del__() 函数,导致对象始终存活在 gc.garbag ...

  3. gitignore 不起作用的解决办法

    gitignore 不起作用的解决办法 - sloong - 博客园 https://www.cnblogs.com/sloong/p/5523244.html Administrator@PC-20 ...

  4. wpf之WrapPanel与StackPanel

    WrapPanel: WrapPanel布局面板将各个控件从左至右按照行或列的顺序罗列,当长度或高度不够是就会自动调整进行换行.他有三个属性 Orientation——根据内容自动换行,ItemHei ...

  5. [archlinux] 迁移T7从T460s到T470

    这已经不是第一次做OS的迁移了,T7早已经迁移过多台设备了.所以,其实只需要如下三步: 1.  rsync 我一直有全系统备份的习惯,T7一直会不定期的全系统rsync到Tstation上面去.所以我 ...

  6. Kafka – kafka consumer

    ConsumerRecords<String, String> records = consumer.poll(100);   /** * Fetch data for the topic ...

  7. Blender 使用

    教程: 1.https://www.youtube.com/watch?v=N8-mE-165b8&index=7&list=PLE885296A496C3D38 快捷键: http: ...

  8. 使用反向代理的http的请求流程

    此文章主要为刚接触反向代理的小伙伴梳理请求流程,以便更好的理解反向代理是何时工作的 流程 由于浏览器是有缓存的,所以本地的hosts文件的信息也会在浏览器端缓存 当客户端发起一个新的请求(例如:输入的 ...

  9. 根据后台加载数据,添加loading动画

    <script> var current = 0; var hit = @hits; $(this).scroll(function(){ var viewHeight =$(this). ...

  10. kubernetes的Controller Manager

    1. Controller Manager简介 Controller Manager作为集群内部的管理控制中心,负责集群内的Node.Pod副本.服务端点(Endpoint).命名空间(Namespa ...