jquery多选项卡效果实例代码(附效果图)

代码如下:

<script type="text/javascript">
    $(function() {
        $(".designerspanel").each(function(){
            $(this).find(".tabspanel #show:not(:first)").hide();
        });

$(".designerspanel li").click(function(){   
            idname=$(this).parents('.designerspanel').attr('id');
            current=$("#"+idname+" li:eq(0)").attr('class');
            current=current.replace("black","");
            $("#"+idname+" li").addClass("black");
            $(this).removeClass("black").addClass(current);
            $("#"+idname+" #show").hide();
            $("#"+idname+" #show").eq($("#"+idname+" li").index(this)).show();
        }).css("cursor", "pointer");
    })
</script>

附上html代码

代码如下:

<div class="designerspanel" id="AG">
    <a name="AG"></a>
    <div class="wordtitle">Designer Name Order A to G</div>
    <div class="tabspanel">
        <ul>
        <li class="red"><span>Designer Name A</span></li>
        <li class="black"><span>Designer Name B</span></li>
        <li class="black"><span>Designer Name C</span></li>
        <li class="black"><span>Designer Name D</span></li>
        <li class="black"><span>Designer Name E</span></li>
        <li class="black"><span>Designer Name F</span></li>
        <li class="black"><span>Designer Name G</span></li>
        </ul>
        <div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$A item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage1"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$B item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage1"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$C item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage1"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$D item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage1"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$E item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage1"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$F item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage1"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$G item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage1"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>
    </div>
</div>

<div class="designerspanel" id="HN">
    <a name="HN"></a>
    <div class="wordtitle">Designer Name Order H to N</div>
    <div class="tabspanel">
        <ul>
        <li class="blue"><span>Designer Name H</span></li>
        <li class="black"><span>Designer Name I</span></li>
        <li class="black"><span>Designer Name J</span></li>
        <li class="black"><span>Designer Name K</span></li>
        <li class="black"><span>Designer Name L</span></li>
        <li class="black"><span>Designer Name M</span></li>
        <li class="black"><span>Designer Name N</span></li>
        </ul>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$H item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage2"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$I item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage2"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$J item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage2"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$K item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage2"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$L item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage2"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$M item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage2"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$N item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage2"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>
    </div>
</div>

<div class="designerspanel" id="OT">
    <a name="OT"></a>
    <div class="wordtitle">Designer Name Order O to T</div>
    <div class="tabspanel">
        <ul>
        <li class="he"><span>Designer Name O</span></li>
        <li class="black"><span>Designer Name P</span></li>
        <li class="black"><span>Designer Name Q</span></li>
        <li class="black"><span>Designer Name R</span></li>
        <li class="black"><span>Designer Name S</span></li>
        <li class="black"><span>Designer Name T</span></li>
        </ul>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$O item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage3"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$P item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage3"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$Q item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage3"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$R item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage3"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$S item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage3"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$T item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage3"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>
    </div>
</div>

<div class="designerspanel" id="UZ">
    <a name="UZ"></a>
    <div class="wordtitle">Designer Name Order U to Z</div>
    <div class="tabspanel">
        <ul>
        <li class="qing"><span>Designer Name U</span></li>
        <li class="black"><span>Designer Name V</span></li>
        <li class="black"><span>Designer Name W</span></li>
        <li class="black"><span>Designer Name X</span></li>
        <li class="black"><span>Designer Name Y</span></li>
        <li class="black"><span>Designer Name Z</span></li>
        </ul>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$U item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage4"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$V item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage4"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$W item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage4"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$X item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage4"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$Y item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage4"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>

<div id="show">
            <div class="namespanel">
                <div class="namespaneltip"></div>
                <div class="designernamelist">
                    <!--{foreach from=$Z item=i}-->
                    <a href="#">{$i.user_name}</a>
                    <!--{/foreach}-->
                </div>
                <div class="namespanelpage4"></div>
            </div>
            <div class="imgspanel"></div>
            <div class="imgspanel"></div>
        </div>
    </div>
</div>

页面效果:

页面比较杂乱,你可以看到很多选项卡,而且有多个选项卡,点击每个选项,内容发生变化,而且颜色也改变。

(0)

相关推荐

  • jQuery之选项卡的简单实现

    jQuery实现选项卡功能.首先将界面搭建好. 有导航头tab_menu,还有内容tab_box. 要实现的效果就是,点击后,将相应的内容显示出来,其他内容隐藏掉. 同时为了展现选中状态,为选中的项添加背景,以示区别. 这一次,我自己写了代码,先看html部分: 复制代码 代码如下: <div class="tab">    <div class="tab_menu">        <ul>            <li

  • js/jQuery简单实现选项卡功能

    第一种方法是用原生的js代码如下: 复制代码 代码如下: <!DOCTYPE html><html><head>    <meta charset="utf-8">    <title>简单选项卡</title>    <style type="text/css">    body,ul,li{margin:0;padding:0;}    body{font:12px/1.5 Ta

  • jQuery EasyUI API 中文文档 - Tabs标签页/选项卡

    Tabs 标签页/选项卡 用$.fn.tabs.defaults重写defaults. 依赖 panel linkbutton 用法示例 创建tabs 1. 经由标记创建Tabs 从标记创建Tabs更容易,我们不需要写任何JavaScript代码.记住把 'easyui-tabs' 类添加到<div/>标记,每个tab panel 经由子<div/>标记被创建,其用法与Panel一样. 复制代码 代码如下: <div id="tt" class="

  • jquery tools之tabs 选项卡/页签

    虽然方便好用,但是个人觉得其在UI方面的表现不是太出彩,今天无意中看到jquery tools--一种基于jquery的UI表现框架,其UI功能展示风格类似(或模仿)flex.该框架提供了tabs(选项卡/页签)overlay(覆盖层),tooltip(提示框),scrollable(滚动信息栏),expose(突出显示),flahembed(视频播放嵌入)六大类功能(其官方网站自称为六大工具),这六大类功能又是每个功能都有自己的独立支持包,不相互干扰,用户完全可以跟据自己需要下载,这样就减少了

  • 实用的Jquery选项卡TAB示例代码

    复制代码 代码如下: <!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> <meta http-equiv=&qu

  • 基于JQuery的6个Tab选项卡插件

    顺便也找 来了不少优秀的Tab选项卡实例,在这里与大家分享一下.当然,最终我没有用到IdTabs以及如下任何一个实例,我只是很不服气的自己写了个小插件,尚 不完善,就不于此共享了.先来看看老外们出色的基于JQuery的各式Tab选项卡吧:1. jQuery 选项卡界面 / 选项卡结构菜单教程这种 类型的菜单在网页设计与开发中非常著名的.此片教程是向大家展示如何使用jQuery的向下滑动/向上滑动效果创建属于你自己的选项卡菜单.要非常留心此 演示哟,你一定会喜欢上它的.演示 | 下载 | 介绍 2

  • jquery自动切换tabs选项卡的具体实现

    本节内容:jquery实现自动切换选项卡. 代码: 复制代码 代码如下: <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%><%String path = request.getContextPath(); %><!DOCTYPE html PUBLIC "-//W3C//DTD HTM

  • jQuery自动切换/点击切换选项卡效果的小例子

    复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK">&

  • jquery实现具有嵌套功能的选项卡

    关于选项卡功能大家一定都不会陌生,无非就是鼠标点击或者悬浮能够切换相关的内容. 通常情况下,大家见到的选项卡都是没有嵌套功能的,也就是说就是完成了一层切换效果,本章节分享一段代码实例,实现了选项卡的嵌套功能,也就是选项卡中嵌套有选项卡功能,也就能够容纳更多的内容. 代码如下: <head> <meta charset="gb2312"> <title>jquery选项卡</title> <style type="text/

  • JQuery Tab选项卡效果代码改进版

    介绍的是基于JQuery实现的一个选项卡效果,重点体现在HTML里没有内联事件处理程序,而是定义在js文件里,做到行为与结构的分离.在实际应用过程中,只 要保证选项卡模块结构代码的完整性,就可以任意添加N个同类选项卡,不需要手动在HTML里绑定事件处理程序以及给要隐藏显示的内容层添加ID. 在这里,我又做了部分的修改,增加了选项卡可自动切换功能,以及选项卡点击相应还是鼠标放上后相应的参数,同时依然支持多次调用. 现在,我把代码贴上,与众博友共享 这是js脚本 复制代码 代码如下: /* jque

随机推荐