1/* 2 Author : Michael Janea 3 Version : 1.0 4 Author URL : www.michaeljanea.me 5*/ 6 7(function($){ 8 9 //define plugin 10 $.fn.mjAccordion = function(options){ 11 12 //extends 13 var mjSettings = $.extend({ 14 duration: 300, 15 toggle : false 16 }, options); 17 18 //function 19 return this.each(function(){ 20 21 //on item click 22 $(this).find('.mj_accordion_item').on('click', function(){ 23 24 //if toggle is true 25 if(mjSettings.toggle){ 26 27 //hidden 28 if(!$(this).hasClass('active')){ 29 30 $(this).addClass('active').siblings('.mj_accordion_content').stop(true, true).slideDown(mjSettings.duration, function(){ 31 32 //add active class and remove inline css generated by jquery 33 $(this).addClass('active').removeAttr('style'); 34 35 }); 36 37 //shown 38 }else{ 39 40 $(this).siblings('.mj_accordion_content').stop(true, true).slideUp(mjSettings.duration, function(){ 41 42 //remove active class and remove inline css generated by jquery 43 $(this).removeClass('active').removeAttr('style').siblings('.mj_accordion_item').removeClass('active'); 44 45 }); 46 47 } 48 49 //toggle if false 50 }else{ 51 52 //show content 53 $(this).addClass('active').siblings('.mj_accordion_content').stop(true, true).slideDown(mjSettings.duration, function(){ 54 55 //add active class and remove inline css generated by jquery 56 $(this).addClass('active').removeAttr('style'); 57 58 }); 59 60 //hide all others 61 $(this).parent().siblings().find('.mj_accordion_content').stop(true, true).slideUp(mjSettings.duration, function(){ 62 63 //remove active class and remove inline css generated by jquery 64 $(this).removeClass('active').removeAttr('style').siblings('.mj_accordion_item').removeClass('active'); 65 66 }); 67 68 } 69 70 }); 71 72 }); 73 74 }; 75 76 try { 77 $('.main-content .mj_accordion').mjAccordion({toggle:true}); 78 } catch(err) { 79 console.log(err); 80 } 81 82})(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.