'); } } function mystartA11y(){ var top_level_nav = $('.sw-mystart-nav'); // Set tabIndex to -1 so that top_level_links can't receive focus until menu is open // school dropdown $(top_level_nav).find('ul').find('a').attr('tabIndex', -1); // my account dropdown $(top_level_nav).next('ul').find('a').attr('tabIndex', -1); var openNavCallback = function(e, element) { // hide open menus hideMyStartBarMenu(); // show school dropdown if ($(element).find('ul').length > 0) { $(element).find('.sw-dropdown').css('display', 'block').attr('aria-hidden', 'false'); $(element).find('.sw-dropdown').find('li:first-child a').focus() } // show my account dropdown if ($(element).next('ul').length > 0) { $(element).next('.sw-dropdown').css('display', 'block').attr('aria-hidden', 'false'); $(element).next('.sw-dropdown').find('li:first-child a').focus(); $('#sw-mystart-account').addClass("clicked-state"); } } $(top_level_nav).click(function (e) { openNavCallback(e, this); }); $('.sw-dropdown-list li').click(function(e) { e.stopImmediatePropagation(); $(this).focus(); }); // Bind arrow keys for navigation $(top_level_nav).off('keydown').keydown(function (e) { if (e.keyCode == 37) { //key left e.preventDefault(); // This is the first item if ($(this).prev('.sw-mystart-nav').length == 0) { $(this).parents('div').find('.sw-mystart-nav').last().focus(); } else { $(this).prev('.sw-mystart-nav').focus(); } } else if (e.keyCode == 38) { //key up e.preventDefault(); // show school dropdown if ($(this).find('ul').length > 0) { $(this).find('div.sw-dropdown').css('display', 'block').find('ul').attr('aria-hidden', 'false').find('a').attr('tabIndex', 0).last().focus(); } // show my account dropdown if ($(this).find('ul').length > 0) { $(this).find('ul.sw-dropdown').css('display', 'block').attr('aria-hidden', 'false').find('a').attr('tabIndex', 0).last().focus(); } } else if (e.keyCode == 39) { //key right e.preventDefault(); // This is the last item if ($(this).next('.sw-mystart-nav').length == 0) { $(this).parents('div').find('.sw-mystart-nav').first().focus(); } else { $(this).next('.sw-mystart-nav').focus(); } } else if (e.keyCode == 40) { //key down e.preventDefault(); // show school dropdown if ($(this).find('ul').length > 0) { $(this).find('div.sw-dropdown').css('display', 'block').find('ul').attr('aria-hidden', 'false').find('a').attr('tabIndex', 0).first().focus(); } // show my account dropdown if ($(this).next('ul').length > 0) { $(this).next('ul.sw-dropdown').css('display', 'block').attr('aria-hidden', 'false').find('a').attr('tabIndex', 0).first().focus(); } } else if (e.keyCode == 13 || e.keyCode == 32) { //enter key // If submenu is hidden, open it e.preventDefault(); openNavCallback(e, this); $(this).parent('li').find('ul[aria-hidden=true]').attr('aria-hidden', 'false').find('a').attr('tabIndex', 0).first().focus(); } else if (e.keyCode == 27) { //escape key e.preventDefault(); hideMyStartBarMenu(); } else { $(this).parent('.sw-mystart-nav').find('ul[aria-hidden=false] a').each(function () { if ($(this).text().substring(0, 1).toLowerCase() == keyCodeMap[e.keyCode]) { $(this).focus(); return false; } }); } }); // school dropdown var startbarlinks = $(top_level_nav).find('ul').find('a'); bindMyStartBarLinks(startbarlinks); // my account dropdown var myaccountlinks = $(top_level_nav).next('ul').find('a'); bindMyStartBarLinks(myaccountlinks); } function bindMyStartBarLinks(links) { $(links).keydown(function (e) { e.stopPropagation(); if (e.keyCode == 38) { //key up e.preventDefault(); // This is the first item if ($(this).parent('li').prev('li').length == 0) { if ($(this).parents('ul').parents('.sw-mystart-nav').length > 0) { $(this).parents('ul').parents('.sw-mystart-nav').focus(); } else { $(this).parents('ul').prev('.sw-mystart-nav').focus(); } } else { $(this).parent('li').prev('li').find('a').first().focus(); } } else if (e.keyCode == 40) { //key down e.preventDefault(); if ($(this).parent('li').next('li').length == 0) { if ($(this).parents('ul').parents('.sw-mystart-nav').length > 0) { $(this).parents('ul').parents('.sw-mystart-nav').focus(); } else { $(this).parents('ul').prev('.sw-mystart-nav').focus(); } } else { $(this).parent('li').next('li').find('a').first().attr('tabIndex', 0); $(this).parent('li').next('li').find('a').first().focus(); } } else if (e.keyCode == 27 || e.keyCode == 37) { // escape key or key left e.preventDefault(); hideMyStartBarMenu(); } else if (e.keyCode == 32) { //enter key e.preventDefault(); window.location = $(this).attr('href'); } else { var found = false; $(this).parent('div').nextAll('li').find('a').each(function () { if ($(this).text().substring(0, 1).toLowerCase() == keyCodeMap[e.keyCode]) { $(this).focus(); found = true; return false; } }); if (!found) { $(this).parent('div').prevAll('li').find('a').each(function () { if ($(this).text().substring(0, 1).toLowerCase() == keyCodeMap[e.keyCode]) { $(this).focus(); return false; } }); } } }); } var megaObj = []; var defaultMegaObj = []; defaultMegaObj = [ { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : " ", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Mega Menu/backpack_on_bench2.jpg", news_desc : " " }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : " ", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Mega Menu/ElemKids2.jpg", news_desc : " " }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : "", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Faces/default-man.jpg", news_desc : "" }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : " ", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Mega Menu/Boy reading and smiling.jpg", news_desc : " " }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : " ", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Mega Menu/Band concert 003.jpg", news_desc : " " }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : " ", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Mega Menu/Girl with back to teacher during lecture.jpg", news_desc : " " }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : "", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Faces/default-man.jpg", news_desc : "" }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : "", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Faces/default-man.jpg", news_desc : "" }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : "", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Faces/default-man.jpg", news_desc : "" }, { link1_title : "", link1_url : "", link1_target : "_self", link2_title : "", link2_url : "", link2_target : "_self", link3_title : "", link3_url : "", link3_target : "_self", link4_title : "", link4_url : "", link4_target : "_self", link5_title : "", link5_url : "", link5_target : "_self", link6_title : "", link6_url : "", link6_target : "_self", news_title : "", news_url : "", news_img : "/cms/lib/ID01904074/Centricity/Template/GlobalAssets/images///Faces/default-man.jpg", news_desc : "" } ];