1/*! 2 * Default commands and js plugins "starters" should be all in this document! 3 * Julio Godoy 05/31/2014 4 */ 5jQuery(function($) { 6 $(document).ready(function() { 7 function handleToggle(hookId, scroll, scrollToggle) { 8 var $answer = $('.question[data="' + hookId + '"] .answer'); 9 //console.log('$answer '+ $answer +' -- hookId '+ hookId +' -- scroll '+ scroll +' -- scrollToggle '+ scrollToggle); 10 11 if (scrollToggle === 0) { 12 // Toggle active class on clicked link 13 $('.question[data="'+hookId+'"] h2 a').toggleClass('active'); // Add active to clicked link 14 15 // Slide toggle the answer 16 $answer.slideToggle(); 17 } 18 19 if (scroll === 0) { 20 // Scroll to the answer section 21 $('html, body').animate({ 22 scrollTop: $answer.offset().top - 200 // Adjust offset as needed 23 }, 500); 24 } 25 } 26 27 // Event handler for main links 28 $('.hook-link').on('click', function(e) { 29 e.preventDefault(); 30 var hookId = $(this).data('hook'); 31 if ($('.question[data="'+hookId+'"] h2 a').hasClass('active')) { 32 handleToggle(hookId, 0, 1); 33 } else { 34 handleToggle(hookId, 0, 0); 35 } 36 }); 37 38 // Event handler for links inside h2 elements 39 $('.question h2 a').on('click', function(e) { 40 e.preventDefault(); 41 var hookId = $(this).parents('.question').attr('data'); 42 if ($(this).hasClass('active')) { 43 handleToggle(hookId, 1, 0); 44 } else { 45 handleToggle(hookId, 0, 0); 46 } 47 }); 48 }); 49}); 50jQuery(document).ready(function($) { 51 $('.fqa-toggle h4 a').on('click', function(e) { 52 e.preventDefault(); // Prevent the default anchor behavior 53 54 // Get the associated .toggle-body element 55 var $toggleBody = $(this).closest('.item'); 56 57 // Toggle the active class 58 $toggleBody.toggleClass('active'); 59 }); 60});
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.