1// ================ Tab To DropDown ============================================== 2 3(function( $ ) { 4 $.fn.tabConvert = function(options) { 5 6 var settings = $.extend({ 7 activeClass: "active", 8 screenSize: 767, 9 }, options ); 10 11 return this.each(function(i) { 12 var wrap = $(this).wrap('<div class="tab-to-dropdown"></div>'), 13 currentItem = $(this), 14 container = $(this).closest('.tab-to-dropdown'), 15 value = $(this).find('.'+settings.activeClass).text(), 16 toggler = '<button class="selected-tab">'+ value +'</button>'; 17 currentItem.addClass('converted-tab'); 18 container.prepend(toggler); 19 20 // function to slide dropdown 21 function tabConvert_toggle(){ 22 currentItem.parent().find('.converted-tab').slideToggle(0); 23 } 24 25 container.find('.selected-tab').click(function(){ 26 tabConvert_toggle(); 27 }); 28 29 currentItem.find('a').click(function(e){ 30 var windowWidth = window.innerWidth; 31 if( settings.screenSize >= windowWidth){ 32 tabConvert_toggle(); 33 var selected_text = $(this).text(); 34 $(this).closest('.tab-to-dropdown').find('.selected-tab').text(selected_text); 35 } 36 }); 37 38 //Remove toggle if screen size is bigger than defined screen size 39 function resize_function(){ 40 var windowWidth = window.innerWidth; 41 if( settings.screenSize >= windowWidth){ 42 currentItem.css('display','none'); 43 currentItem.parent().find('.selected-tab').css('display',''); 44 }else{ 45 currentItem.css('display',''); 46 currentItem.parent().find('.selected-tab').css('display','none'); 47 } 48 } 49 resize_function(); 50 51 $(window).resize(function(){ 52 resize_function(); 53 }); 54 55 }); 56 }; 57 58// Toggle will appear on size 991px 59 $('.nav-tab').tabConvert({ 60 activeClass: "active", 61 screenSize: 767, 62 }); 63 64}( jQuery ));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.