JavaScript slide toggle like github language stats

I have been developing github unofficial card. So that, I designed a simple card for this and create little script for toggling language stats and general stats.

After that I realised one problem when I toggle.

I want to it should be like https://github.com/github/developer.github.com

you can check with toggling language colors: enter image description here enter image description here

my problematic html is here:

<div class="panel panel-default">


        <div class="panel-body" style="min-height:60px;max-height: 60px;">
                <ul id="language-stats">
                        <li>
                                <span class="color-block language-color" style="background-color:#4F5D95;"></span>
                                <span class="lang">PHP</span>
                                <span class="percent">64.5%</span>
                        </li>
                        <li>
                                <span class="color-block language-color" style="background-color:#ccc;"></span>
                                <span class="lang">Smarty</span>
                                <span class="percent">19.6%</span>
                        </li>
                        <li>

                                <span class="color-block language-color" style="background-color:#563d7c;"></span>
                                <span class="lang">CSS</span>
                                <span class="percent">7.9%</span>

                        </li>
                        <li>

                                <span class="color-block language-color" style="background-color:#f1e05a;"></span>
                                <span class="lang">JavaScript</span>
                                <span class="percent">6.4%</span>

                        </li>
                        <li>

                                <span class="color-block language-color" style="background-color:#e44b23;"></span>
                                <span class="lang">HTML</span>
                                <span class="percent">1.6%</span>

                        </li>

                </ul>
                <ul id="general-stats">
                    <li><i class="fa fa-history"></i> <small>22 commits</small></li>

                    <li><i class="fa fa-star"></i> <small>5 stars</small></li>

                    <li><i class="fa fa-code-fork"></i> <small>3 forks</small></li>
                </ul>
        </div>
            <div class="languages" data-toggle="tooltip" data-placement="bottom" title="Click for language details">
                <span class="language-color" aria-label="PHP 64.5%" style="width:64.5%; background-color:#4F5D95;" itemprop="keywords">PHP</span>
                <span class="language-color" aria-label="Smarty 19.6%" style="width:19.6%; background-color:#ccc;" itemprop="keywords">Smarty</span>
                <span class="language-color" aria-label="CSS 7.9%" style="width:7.9%; background-color:#563d7c;" itemprop="keywords">CSS</span>
                <span class="language-color" aria-label="JavaScript 6.4%" style="width:6.4%; background-color:#f1e05a;" itemprop="keywords">JavaScript</span>
                <span class="language-color" aria-label="HTML 1.6%" style="width:1.6%; background-color:#e44b23;" itemprop="keywords">HTML</span>

        </div>
</div>

CSS

body {
            padding:20px;
        }
        .languages {
            padding:0;
        }
        .languages {
            display: table;
            width: 100%;
            border-bottom-left-radius: 3px;
            border-bottom-right-radius: 3px;
            overflow: hidden;
            border: 1px solid #ddd;
            border-top: 0;
            cursor: pointer;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
        .languages .language-color {
            display: table-cell;
            line-height: 7px;
            text-indent: -9999px;
        }

        #general-stats {
            padding:0;
            display: table;
            width: 100%;
            table-layout: fixed;
        }
        #general-stats li {
            text-align: center;
            display: table-cell;
        }
        #language-stats {
            padding:0;
            display: none;
            width: 100%;
            table-layout: fixed;
        }
        #language-stats li {
            text-align: center;
            display: table-cell;
        }
        li .language-color {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 50%;
        }

my problematic js is here:

<script>
    function toggleLanguages() {
        $('#language-stats').toggle( 'slide', {direction:'up'} , 300);
    }
    function toggleGeneralStats() {
        $('#general-stats').toggle( 'slide', {direction:'up'} , 300);
    }
    $('.languages').click(function() {
        if($('#general-stats').css('display') == "none") {
            $('#general-stats').toggle( 'slide', {direction:'up'} , 300, toggleLanguages());
        } else {
            $('#language-stats').toggle( 'slide', {direction:'up'} , 300, toggleGeneralStats());
            $('#language-stats').css('display','table');
        }

    });
</script>

http://jsfiddle.net/fyww2t4n/

Kind Regards.

Answer:1

Get previous location path on back button click event using by angular.js What I want? I want to go previous page when i click the back button in my current page. HTML <input type="button" ...

Get previous location path on back button click event using by angular.js What I want? I want to go previous page when i click the back button in my current page. HTML <input type="button" ...

I am trying to send a json to a php script on a server and even though I have included header in php script to have CORS the console throws error error message XMLHttpRequest cannot load http://...

I am trying to send a json to a php script on a server and even though I have included header in php script to have CORS the console throws error error message XMLHttpRequest cannot load http://...

  1. cors not working with https
  2. cors not working with localhost
  3. cors not working with postman
  4. cors not working with windows authentication
  5. cors not working with spring security

I am new to ExtJs. I have created a twitter widget on twitter. It just works fine on simple html page. As twitter says you just need to include <a class="twitter-timeline" href="https://twitter....

I am new to ExtJs. I have created a twitter widget on twitter. It just works fine on simple html page. As twitter says you just need to include <a class="twitter-timeline" href="https://twitter....

  1. embed twitter widget into website

How do I parse this to int? "'10'" Thanks.

How do I parse this to int? "'10'" Thanks.

  1. convert double quotes to html
  2. convert double quotes to ascii
  3. convert double quotes javascript
  4. vscode convert double quotes to single
  5. php convert double quotes to single
  6. json convert double quotes
  7. php convert double quotes
  8. python convert double quotes
  9. java convert double quotes
  10. bash convert double quote