Hot File

Tab displays content created with CSS & jQuery

View: 620    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: References   Fields: Other

18 point/5 review File has been tested

jQuery is the most popular JavaScript library today, mastering jQuery will help you to be better for the web design as well as becoming a Front End Developer later. And the best way to learn is not painstakingly reading but the practice as much as possible.​

Introduction

jQuery is the most popular JavaScript library today, mastering jQuery will help you to be better for the web design as well as becoming a Front End Developer later. And the best way to learn is not painstakingly reading but the practice as much as possible.

Today I will share with you a little jQuery segment only, but it will help you understand more about it and add a small but functional website almost always needed, which is to create tabs display cabinet solution.

HTML

First we will create tabs using the <ul> as follows:

1
2
3
4
5
6
<ul class="tabs">
    <li class="active">Call of Duty</li>
    <li>Mortal Combat</li>
    <li>Halo</li>
    <li>Portal</li>
</ul>

Next is the text for the tab

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<div class="tab_container">
<div class="tab_content" id="tab1">
<img alt="" src="images/cod.jpg" />
 
 <strong>
 Call of Duty: Black Ops bears the series' standard superbly,
 delivering an engrossing campaign and exciting competitive multiplayer.
 </strong></div>
<!-- #tab1 -->
<div class="tab_content" id="tab2">
<img alt="" src="images/mortal combat.jpg" />
 
 <strong>
 Mortal Kombat returns after a lengthy hiatus and puts players
 back into the Tournament for 2D fighting with gruesome combat.
 </strong></div>
<!-- #tab2 -->
<div class="tab_content" id="tab3">
<img alt="" src="images/halo.jpg" />
 
 <strong>
 Halo: Reach is the culmination of the superlative combat, sensational
 multiplayer, and seamless online integration that are the hallmarks
 of this superb series.
 </strong></div>
<!-- #tab3 -->
<div class="tab_content" id="tab4">
<img alt="" src="images/portal.jpg" />
 
 <strong>
 Portal 2 is an action shooter game from Valve Software that draws
 from the original formula of innovative gameplay, story, and music,
 which earned the original Portal more than 70 industry accolades.
 </strong></div>
<!-- #tab4 --></div>
<pre>
 <!-- .tab_container -->

CSS

Now we'll format the CSS tab so easy to see, we will simply following formats:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
ul.tabs {
        margin: 0;
        padding: 0;
        float: left;
        list-style: none;
        height: 32px;
        border-bottom: 1px solid #999999;
        border-left: 1px solid #999999;
        width: 100%;
}
 
ul.tabs li {
        float: left;
        margin: 0;
        cursor: pointer;
        padding: 0px 21px ;
        height: 31px;
        line-height: 31px;
        border: 1px solid #999999;
        border-left: none;
        font-weight: bold;
        background: #EEEEEE;
        overflow: hidden;
        position: relative;
}
 
ul.tabs li:hover {
        background: #CCCCCC;
}
 
ul.tabs li.active{
        background: #FFFFFF;
        border-bottom: 1px solid #FFFFFF;
}
 
.tab_container {
        border: 1px solid #999999;
        border-top: none;
        clear: both;
        float: left;
        width: 100%;
        background: #FFFFFF;
}
 
.tab_content {
        padding: 20px;
        font-size: 1.2em;
        display: none;
}
 
#container {
        width: 600px;
        margin: 0 auto;
}

jQuery

To tab can act, you need to insert the following jQuery:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
$(document).ready(function() {
    // ẩn tất cả các thẻ div với class="tab_content".
    $(".tab_content").hide();
    // Mặc định nội dung thẻ tab đầu tiên sẽ được hiển thị
    $(".tab_content:first").show();
 
    $("ul.tabs li").click(function() {
        // gỡ bỏ class="active" cho tất cả các thẻ
        $("ul.tabs li").removeClass("active");
        // chèn class="active" vào phần tử </li> vừa được click
        $(this).addClass("active");
        // ẩn tất cả thẻ với class="tab_content"
        $(".tab_content").hide();
        //Hiển thị nội dung thẻ tab được click với hiệu ứng Fade In
        var activeTab = $(this).attr("rel");
        $("#"+activeTab).fadeIn();
    });
});

In the code above I have a comment for each statement, if you do not yet understand, do not hesitate to leave a message in the form of comments, I will explain in more detail. I hope that with this short article, you begin to learn about new jQuery will have more experience in the use and code with jQuery.

 

Tab displays content created with CSS & jQuery

Tab displays content created with CSS & jQuery Posted on 12-08-2015  jQuery is the most popular JavaScript library today, mastering jQuery will help you to be better for the web design as well as becoming a Front End Developer later. And the best way to learn is not painstakingly reading but the practice as much as possible.​ 3.6/10 620

Comment:

To comment you must be logged in members.

Files with category

  • Instructions for installing and configuring Windows Live Mail on Windows 10 simple

    View: 2688    Download: 0   Comment: 0   Author: none  

    Instructions for installing and configuring Windows Live Mail on Windows 10 simple

    Category: References
    Fields: Other

    0/3 review
    Windows 10 pre-installed Mail application for managing personal email on the device. The latest version of this application but improved a lot and support other email accounts such as Gmail or Yahoo Mail but users almost no "salty" really with this...

  • Step by step instructions to create social networking buttons with CSS3

    View: 1876    Download: 0   Comment: 0   Author: none  

    Step by step instructions to create social networking buttons with CSS3

    Category: References
    Fields: Other

    0.75/6 review
    CSS3 help web designers have the ability to create buttons (buttons) very nice, today I will share with you two tips decoration for button in your web becomes radiant beauty that no need to use photoshop.

  • You should understand the CSS Box Shadow

    View: 2029    Download: 0   Comment: 0   Author: none  

    You should understand the CSS Box Shadow

    Category: References
    Fields: Other

    1.3181818181818/11 review
    Effects his shadow was introduced in the previous article, however, in this article, I will guide more specific about shadow attributes, you try it with anything. First we try to learn css following paragraph:

  • How to do button movement with beautiful CSS3

    View: 1716    Download: 0   Comment: 0   Author: none  

    How to do button movement with beautiful CSS3

    Category: References
    Fields: Other

    0/4 review
    Previously to create motion effects button, you must draw the button in photoshop, then switched to flash to make it possible to move. But now you need not spend too much time doing it, all because of the emergence of CSS3.

  • Create a dropdown menu with CSS3 effects with beautiful transtions

    View: 1991    Download: 0   Comment: 0   Author: none  

    Create a dropdown menu with CSS3 effects with beautiful transtions

    Category: References
    Fields: Other

    0.45/10 review
    More of the dropdown menu you want to introduce to you, this will have the effect menu transitions (converted background of menu background from pale to dark). This menu works well on browsers like FF, Chrome, Safary, but unfortunately did not work...

  • How to hack css for all browsers you should know

    View: 1625    Download: 0   Comment: 0   Author: none  

    How to hack css for all browsers you should know

    Category: References
    Fields: Other

    1.6875/8 review
    In the process of web design, which makes it the most headaches is how to design web pages that you can run on the browser. Especially when clients use the old as IE6 browser such. However, with this article, you will easily edit interface runs well...

  • Create Accordion with extremely beautiful CSS3

    View: 2025    Download: 0   Comment: 0   Author: none  

    Create Accordion with extremely beautiful CSS3

    Category: References
    Fields: Other

    0.9/5 review
    Accordion is a technique that helps you shortened the content that you want displayed on the website. It is often used for the display of submenus. In addition you can also use it for content, images. Before applying this procedure, you have to use...

  • Create the effect Hovercho images with Webkit and CSS3 is great

    View: 1722    Download: 0   Comment: 0   Author: none  

    Create the effect Hovercho images with Webkit and CSS3 is great

    Category: References
    Fields: Other

    1.125/4 review
    WebKit is one open source application framework provides the necessary components built one for your web browser. Along with CSS3, cả have contributed to very nice effect những previously only using JavaScript or JQuery thực beige.​

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd