Home  >  Article  >  Web Front-end  >  How to define a navigation bar menu using js and JQuery

How to define a navigation bar menu using js and JQuery

迷茫
迷茫Original
2017-03-26 17:05:551631browse

Use js and JQuery to define a navigation bar


Effect:

## 1. HTML code:

menu1

menu2

menu3

menu4

menu5

menu6

111

2. JS code


$(".M_Button").click(function () {
        $(".M_Button").removeClass("M_Button_inner");
        $(this).addClass("M_Button_inner");
        $(".Content").hide();
        TabButton = $(this).attr('id');
        $('#co' + TabButton).css('display', 'block');
    });

3. css code

.M_Button {
    float: left;
    height: 42px;
    width: 98px;
    cursor: pointer;
    line-height: 42px;
    color: #FFFFFF;
    text-align: center;
    font-size: 14px;
    background-image: url(../../images/emergency/ReffectRadius/The_pop-up_1.png);
    background-repeat: no-repeat;
    background-position: right;
}

    .M_Button:hover {
        color: #000;
        background-image: url(../../images/emergency/ReffectRadius/The_pop-up_2.png);
        background-repeat: repeat-x;
    }.M_Button_inner {
    color: #000;
    background-image: url(../../images/emergency/ReffectRadius/The_pop-up_2.png);
    background-repeat: repeat-x;
}.Content {
    float: left;
    height: 438px;
    width: 100%;    /*background-image: url(../../../../images/Inspection/Hidden_danger/background.png);*/}.M_Content {
    height: 434px;
    width: 100%;
    z-index: 5;
    position: absolute;    /*background-color: #666;*/
    right: 2px;
    top: 0px;
}

The above is the detailed content of How to define a navigation bar menu using js and JQuery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn