1/** 2 * Activates the two separate javascript functions for drop down buttons on page load. 3 **/ 4$(document).ready(function(){ 5 selectFirstElement(); 6 deselectFirstElement(); 7}); 8 9/** 10 * When a dropdown menu button is opened this function will autoselect the first element in the list. 11 */ 12function selectFirstElement() { 13 $(document).on('shown.bs.dropdown', function(event) { 14 var dropdown = $(event.target); 15 16 // Set aria-expanded to true 17 dropdown.find('.dropdown-menu').attr('aria-expanded', true); 18 19 // Set focus on the first link in the dropdown 20 setTimeout(function() { 21 dropdown.find('.dropdown-menu li:first-child a').focus(); 22 }, 10); 23 }); 24} 25 26/** 27 * When a dropdown menu is closed this function will deselect the selected element in the list. 28 */ 29function deselectFirstElement() { 30 $(document).on('hidden.bs.dropdown', function(event) { 31 var dropdown = $(event.target); 32 33 // Set aria-expanded to false 34 dropdown.find('.dropdown-menu').attr('aria-expanded', false); 35 36 // Set focus back to dropdown toggle 37 dropdown.find('.dropdown-toggle').focus(); 38 }); 39}
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.