1/* Sample scripts for RWD nav patterns 2 (c) 2012 Maggie Wachs, Filament Group, Inc - http://filamentgroup.com/examples/rwd-nav-patterns/GPL-LICENSE.txt 3 Last updated: March 2012 4 Dependencies: jQuery 5*/ 6 7 8 9jQuery(function($){ 10 11 $('.nav-primary') 12 // test the menu to see if all items fit horizontally 13 .bind('testfit', function(){ 14 var nav = $(this), 15 items = nav.find('a'); 16 17 $('body').removeClass('nav-menu'); 18 19 // when the nav wraps under the logo, or when options are stacked, display the nav as a menu 20 if ( (nav.offset().top > nav.prev().offset().top) || ($(items[items.length-1]).offset().top > $(items[0]).offset().top) ) { 21 22 // add a class for scoping menu styles 23 $('body').addClass('nav-menu'); 24 25 }; 26 }) 27 28 // toggle the menu items' visiblity 29 .find('h3') 30 .bind('click focus', function(){ 31 $(this).parent().toggleClass('expanded') 32 }); 33 34 // ...and update the nav on window events 35 $(window).bind('load resize orientationchange', function(){ 36 $('.nav-primary').trigger('testfit'); 37 }); 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.