1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 3* FIXED NAVIGATION 4* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 5* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 6(function($) { 7 "use strict"; 8 // EXISTS ALSO IN SCRIPT.JS 9 function UserSidebar() { 10 var topbarHeight = $("#topbar").height(), 11 menuHeight = $("#navbar").height(), 12 sidebarTop = 0; 13 if($("topbar").hasClass("topbar-closed")){ 14 sidebarTop = menuHeight + topbarHeight; 15 } 16 else{ 17 sidebarTop = menuHeight; 18 } 19 $("#user-sidebar").css("padding-top",sidebarTop); 20 } 21 22 $(window).bind('load', function(){ 23 fixedMenuPosition(); 24 }); 25 26 $(window).bind('scroll', function(){ 27 fixedMenuPosition(); 28 }); 29 30 $(window).bind( 'resize', function () { 31 fixedMenuPosition(); 32 }); 33 34 function fixedMenuPosition() { 35 var scroll = $(window).scrollTop(), 36 menu_is_horizontal = $('body').hasClass('menu-is-horizontal'), 37 adminbar_height = parseInt($("html").css("margin-top").replace("px", "")), 38 $navbar = $("#navbar"), 39 $navigation = $("#navigation"), 40 $is_modern_skin = $('body').hasClass("is-modern-skin"), 41 $is_glass_skin = $('body').hasClass("is-glass-skin"); 42 43 var height = $('#main-header').height(); 44 if(height === 0) 45 height = $navbar.height(); 46 if(menu_is_horizontal) 47 height += $navigation.height() + 50; 48 49 var animation_classes = 'animate-me animated slideInDown'; 50 if($is_modern_skin) { animation_classes = 'animate-me animated fadeIn'; } 51 if($is_glass_skin) { animation_classes = 'animate-me animated fadeIn'; } 52 if($(window).width() <= 600) { 53 54 var $body = $('body'); 55 if( $body.hasClass( 'has_fixed_navbar' ) ) 56 $body.addClass( 'has-navigation-fixed' ); 57 else 58 $body.removeClass( 'has-navigation-fixed' ); 59 60 animation_classes = ''; 61 62 var top_scroll = (adminbar_height - scroll > 0) ? (adminbar_height - scroll) : 0; 63 $navbar.css('top', top_scroll); 64 65 var navbar_plus = 0; 66 if($(window).width() <= 450) 67 navbar_plus = $navbar.height(); 68 69 if(scroll > adminbar_height) { 70 //addFixedMenu(menu_is_horizontal, animation_classes); 71 72 if(menu_is_horizontal) 73 $navigation.css('top',$navbar.height()); 74 else 75 $navigation.css('top',parseInt(navbar_plus + top_scroll)); 76 } else { 77 //removeFixedMenu(menu_is_horizontal); 78 79 if(menu_is_horizontal) 80 $navigation.css('top',parseInt( $navbar.height() + adminbar_height - scroll)); 81 else 82 $navigation.css('top',parseInt(navbar_plus + adminbar_height - scroll)); 83 } 84 } else { 85 86 $navbar.css('top', adminbar_height); 87 88 if(menu_is_horizontal) 89 $navigation.css('top',parseInt( $navbar.height() + adminbar_height )); 90 else 91 $navigation.css('top', adminbar_height); 92 93 // todo Should this be actually removed? Now the fixed menu is set on page loading 94 if(scroll >= height + 50 ) { 95 addFixedMenu(menu_is_horizontal, animation_classes); 96 } else if(scroll <= 0){ 97 removeFixedMenu(menu_is_horizontal); 98 } 99 } 100 101 } 102 103 function addFixedMenu(is_horizontal, animation){ 104 $('body.has-navigation-fixed .modern-top-menu').addClass('modern-is-fixed'); 105 $('body.has-navigation-fixed .glass-top-menu').addClass('glass-is-fixed');
106 var $nav_width = $('#navigation').width(); 107 $('body.has-navigation-fixed .menu-is-vertical .modern-is-fixed').css({'margin-left' : $nav_width + 'px'}); 108 109 if($('.glass-top-menu').length > 0 && $('.navigation-hidden').length > 0 ) { 110 $('.menu-is-vertical .glass-top-menu').css({'margin-left' : '0','top':'32px'}) 111 } 112 $("#navbar").addClass('navigation-fixed ' + animation); 113 if (is_horizontal) 114 $("#navigation").addClass('navigation-fixed ' + animation); 115 $("body").addClass('has-navigation-fixed'); 116 $("#user-sidebar").addClass('onscroll'); 117 if ($("#user-sidebar").length > 0) { 118 UserSidebar(); 119 } 120 } 121 122 function removeFixedMenu(is_horizontal,$is_modern_skin,$is_glass_skin) { 123 $('body.has-navigation-fixed .modern-top-menu').removeClass('modern-is-fixed'); 124 $('body.has-navigation-fixed .glass-top-menu').removeClass('glass-is-fixed'); 125 $("#navbar").removeClass('navigation-fixed animated slideInDown fadeIn'); 126 if(is_horizontal) 127 $("#navigation").removeClass('navigation-fixed animated slideInDown fadeIn'); 128 if($is_modern_skin) { 129 $("#navigation").removeClass('navigation-fixed animated fadeIn'); 130 } 131 if($is_glass_skin) { 132 $("#navigation").removeClass('navigation-fixed animated fadeIn'); 133 } 134 $("body").removeClass('has-navigation-fixed'); 135 $("#user-sidebar").removeClass('onscroll'); 136 if($("#user-sidebar").length >0 ){ 137 UserSidebar(); 138 } 139 } 140})(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.