navigation_vertical_sizing.js 1.23 KB
Newer Older
Muhamad's avatar
Muhamad committed
1 2 3 4 5 6 7 8 9 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
/* ------------------------------------------------------------------------------
*
*  # Vertical navigation sizing
*
*  Specific JS code additions for navigation_vertical_sizing.html page
*
*  Version: 1.0
*  Latest update: Aug 1, 2015
*
* ---------------------------------------------------------------------------- */

$(function() {

    // Initialize Select2 select
    $('.select').select2({
        width: 180,
        minimumResultsForSearch: Infinity
    });


    // Apply size on change
    $('.select').on('change', function(){

        // Value of selected item
        var vals = $(this).val();


        // Large
        if ((vals == 'large')) {
            $('.navigation-main').addClass('navigation-lg');
        }
        else {
            $('.navigation-main').removeClass('navigation-lg');
        }

        // Small
        if ((vals == 'small')) {
            $('.navigation-main').addClass('navigation-sm');
        }
        else {
            $('.navigation-main').removeClass('navigation-sm');
        }

        // Mini
        if ((vals == 'mini')) {
            $('.navigation-main').addClass('navigation-xs');
        }
        else {
            $('.navigation-main').removeClass('navigation-xs');
        }
    });
    
});