1(function($){ 2 var $et_pb_post_fullwidth = $( '.single.et_pb_pagebuilder_layout.et_full_width_page' ), 3 et_is_mobile_device = navigator.userAgent.match( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/ ), 4 et_is_ipad = navigator.userAgent.match( /iPad/ ), 5 $et_container = $( '.container' ), 6 et_container_width = $et_container.width(), 7 et_is_fixed_nav = $( 'body' ).hasClass( 'et_fixed_nav' ), 8 et_is_vertical_fixed_nav = $( 'body' ).hasClass( 'et_vertical_fixed' ), 9 et_is_rtl = $( 'body' ).hasClass( 'rtl' ), 10 et_hide_nav = $( 'body' ).hasClass( 'et_hide_nav' ), 11 et_header_style_left = $( 'body' ).hasClass( 'et_header_style_left' ), 12 et_vertical_navigation = $( 'body' ).hasClass( 'et_vertical_nav' ), 13 $top_header = $('#top-header'), 14 $main_header = $('#main-header'), 15 $main_container_wrapper = $( '#page-container' ), 16 $et_transparent_nav = $( '.et_transparent_nav' ), 17 $et_main_content_first_row = $( '#main-content .container:first-child' ), 18 $et_main_content_first_row_meta_wrapper = $et_main_content_first_row.find('.et_post_meta_wrapper:first'), 19 $et_main_content_first_row_meta_wrapper_title = $et_main_content_first_row_meta_wrapper.find( 'h1' ), 20 $et_main_content_first_row_content = $et_main_content_first_row.find('.entry-content:first'), 21 $et_single_post = $( 'body.single-post' ), 22 $et_window = $(window), 23 etRecalculateOffset = false, 24 et_header_height, 25 et_header_modifier, 26 et_header_offset, 27 et_primary_header_top, 28 $et_vertical_nav = $('.et_vertical_nav'), 29 $et_header_style_split = $('.et_header_style_split'), 30 $et_top_navigation = $('#et-top-navigation'), 31 $logo = $('#logo'), 32 $et_pb_first_row = $( 'body.et_pb_pagebuilder_layout .et_pb_section:first-child' ); 33 34 $(document).ready( function(){ 35 var $et_top_menu = $( 'ul.nav' ), 36 $et_search_icon = $( '#et_search_icon' ), 37 et_parent_menu_longpress_limit = 300, 38 et_parent_menu_longpress_start, 39 et_parent_menu_click = true; 40 41 $et_top_menu.find( 'li' ).hover( function() { 42 if ( ! $(this).closest( 'li.mega-menu' ).length || $(this).hasClass( 'mega-menu' ) ) { 43 $(this).addClass( 'et-show-dropdown' ); 44 $(this).removeClass( 'et-hover' ).addClass( 'et-hover' ); 45 } 46 }, function() { 47 var $this_el = $(this); 48 49 $this_el.removeClass( 'et-show-dropdown' ); 50 51 setTimeout( function() { 52 if ( ! $this_el.hasClass( 'et-show-dropdown' ) ) { 53 $this_el.removeClass( 'et-hover' ); 54 } 55 }, 200 ); 56 } ); 57 58 // Dropdown menu adjustment for touch screen 59 $et_top_menu.find('.menu-item-has-children > a').on( 'touchstart', function(){ 60 et_parent_menu_longpress_start = new Date().getTime(); 61 } ).on( 'touchend', function(){ 62 var et_parent_menu_longpress_end = new Date().getTime() 63 if ( et_parent_menu_longpress_end >= et_parent_menu_longpress_start + et_parent_menu_longpress_limit ) { 64 et_parent_menu_click = true; 65 } else { 66 et_parent_menu_click = false; 67 68 // Close sub-menu if toggled 69 var $et_parent_menu = $(this).parent('li'); 70 if ( $et_parent_menu.hasClass( 'et-hover') ) { 71 $et_parent_menu.trigger( 'mouseleave' ); 72 } else { 73 $et_parent_menu.trigger( 'mouseenter' ); 74 } 75 } 76 et_parent_menu_longpress_start = 0; 77 } ).click(function() { 78 if ( et_parent_menu_click ) { 79 return true; 80 } 81 82 return false; 83 } ); 84 85 $et_top_menu.find( 'li.mega-menu' ).each(function(){ 86 var $li_mega_menu = $(this), 87 $li_mega_menu_item = $li_mega_menu.children( 'ul' ).children( 'li' ), 88 li_mega_menu_item_count = $li_mega_menu_item.length; 89 90 if ( li_mega_menu_item_count < 4 ) { 91 $li_mega_menu.addClass( 'mega-menu-parent mega-menu-parent-' + li_mega_menu_item_count ); 92 } 93 }); 94 95 if ( $et_header_style_split.length && $et_vertical_nav.length < 1 ) { 96 function et_header_menu_split(){ 97 var $logo_container = $( '#main-header > .container > .logo_container' ), 98 $logo_container_splitted = $('.centered-inline-logo-wrap > .logo_container'), 99 et_top_navigation_li_size = $et_top_navigation.children('nav').children('ul').children('li').size(), 100 et_top_navigation_li_break_index = Math.round( et_top_navigation_li_size / 2 ) - 1; 101 102 if ( $et_window.width() > 980 && $logo_container.length ) { 103 $('<li class="centered-inline-logo-wrap"></li>').insertAfter($et_top_navigation.find('nav > ul >li:nth('+et_top_navigation_li_break_index+')') ); 104 $logo_container.appendTo( $et_top_navigation.find('.centered-inline-logo-wrap') ); 105 } 106 107 if ( $et_window.width() <= 980 && $logo_container_splitted.length ) { 108 $logo_container_splitted.prependTo('#main-header > .container'); 109 $('#main-header .centered-inline-logo-wrap').remove(); 110 } 111 } 112 et_header_menu_split(); 113 114 $(window).resize(function(){ 115 et_header_menu_split(); 116 }); 117 } 118 119 if ( $('ul.et_disable_top_tier').length ) { 120 $("ul.et_disable_top_tier > li > ul").prev('a').attr('href','#'); 121 } 122 123 if ( $( '.et_vertical_nav' ).length ) { 124 if ( $( '#main-header' ).height() < $( '#et-top-navigation' ).height() ) { 125 $( '#main-header' ).height( $( '#et-top-navigation' ).height() + $( '#logo' ).height() + 100 ); 126 } 127 } 128 129 window.et_calculate_header_values = function() { 130 var $top_header = $( '#top-header' ), 131 secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHe
131ight() : 0, 132 admin_bar_height = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).innerHeight() : 0; 133 134 et_header_height = $( '#main-header' ).innerHeight() + secondary_nav_height, 135 et_header_modifier = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56, 136 et_header_offset = et_header_modifier + admin_bar_height; 137 138 et_primary_header_top = secondary_nav_height + admin_bar_height; 139 } 140 141 var $comment_form = $('#commentform'); 142 143 et_pb_form_placeholders_init( $comment_form ); 144 145 $comment_form.submit(function(){ 146 et_pb_remove_placeholder_text( $comment_form ); 147 }); 148 149 et_duplicate_menu( $('#et-top-navigation ul.nav'), $('#et-top-navigation .mobile_nav'), 'mobile_menu', 'et_mobile_menu' ); 150 151 if ( $( '#et-secondary-nav' ).length ) { 152 $('#et-top-navigation #mobile_menu').append( $( '#et-secondary-nav' ).clone().html() ); 153 } 154 155 function et_change_primary_nav_position( delay ) { 156 setTimeout( function() { 157 var $body = $('body'), 158 $wpadminbar = $( '#wpadminbar' ), 159 $top_header = $( '#top-header' ), 160 et_primary_header_top = 0; 161 162 if ( $wpadminbar.length ) { 163 et_primary_header_top += $wpadminbar.innerHeight(); 164 } 165 166 if ( $top_header.length ) { 167 et_primary_header_top += $top_header.innerHeight(); 168 } 169 170 if ( ! $body.hasClass( 'et_vertical_nav' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) { 171 $('#main-header').css( 'top', et_primary_header_top ); 172 } 173 }, delay ); 174 } 175 176 function et_hide_nav_transofrm( ) { 177 var $body = $( 'body' ), 178 $body_height = $( document ).height(), 179 $viewport_height = $( window ).height() + et_header_height + 200; 180 181 if ( $body.hasClass( 'et_hide_nav' ) || $body.hasClass( 'et_hide_nav_disabled' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) { 182 if ( $body_height > $viewport_height ) { 183 if ( $body.hasClass( 'et_hide_nav_disabled' ) ) { 184 $body.addClass( 'et_hide_nav' ); 185 $body.removeClass( 'et_hide_nav_disabled' ); 186 } 187 $('#main-header').css( 'transform', 'translateY(-' + et_header_height +'px)' ); 188 $('#top-header').css( 'transform', 'translateY(-' + et_header_height +'px)' ); 189 } else { 190 $('#main-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } ); 191 $('#top-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } ); 192 $body.removeClass( 'et_hide_nav' ); 193 $body.addClass( 'et_hide_nav_disabled' ); 194 } 195 } 196 } 197 198 function et_fix_page_container_position(){ 199 var et_window_width = $et_window.width(), 200 $top_header = $( '#top-header' ), 201 secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0; 202 203 // Set data-height-onload for header if the page is loaded on large screen 204 // If the page is loaded from small screen, rely on data-height-onload printed on the markup, 205 // prevent window resizing issue from small to large 206 if ( et_window_width > 980 && ! $main_header.attr( 'data-height-loaded' ) ){ 207 $main_header.attr({ 'data-height-onload' : $main_header.height(), 'data-height-loaded' : true }); 208 } 209 210 // Use on page load calculation for large screen. Use on the fly calculation for small screen (980px below) 211 if ( et_window_width <= 980 ) { 212 var header_height = $main_header.innerHeight() + secondary_nav_height - 1; 213 214 // If transparent is detected, #main-content .container's padding-top needs to be added to header_height 215 // And NOT a pagebuilder page 216 if ( $et_transparent_nav.length && ! $et_pb_first_row.length ) { 217 header_height += 58; 218 } 219 } else { 220 221 // Get header height from header attribute 222 var header_height = parseInt( $main_header.attr( 'data-height-onload' ) ) + secondary_nav_height; 223 224 // Non page builder page needs to be added by #main-content .container's fixed height 225 if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_main_content_first_row.length ) { 226 header_height += 58; 227 } 228 } 229 230 // Specific adjustment required for transparent nav + not vertical nav 231 if ( $et_transparent_nav.length && ! $et_vertical_nav.length ){ 232 233 // Add class for first row for custom section padding purpose 234 $et_pb_first_row.addClass( 'et_pb_section_first' ); 235 236 // List of conditionals 237 var is_pb = $et_pb_first_row.length, 238 is_post_pb = is_pb && $et_single_post.length, 239 is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length, 240 is_post_pb_full_layout_no_title = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length, 241 is_pb_fullwidth_section_first = $et_pb_first_row.is( '.et_pb_fullwidth_section' ), 242 is_no_pb_mobile = et_window_width <= 980 && $et_main_content_first_row.length; 243 244 if ( is_post_pb && ! ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first ) ) { 245 246 /* Desktop / Mobile + Single Post */ 247 248 /* 249 * EXCEPT for fullwidth layout + fullwidth section ( at the first row ). 250 * It is basically the same as page + fullwidth section with few quirk. 251 * Instead of duplicating the conditional for each module, it'll be simpler to negate 252 * fullwidth layout + fullwidth section in is_post_pb and rely it to is_pb_fullwidth_section_first 253 */ 254 255 // Remove main content's inline padding to styling to prevent looping padding-top calculation 256 $et_main_content_first_row.css({ 'paddingTop' : '' }); 257 258 if ( et_window_width < 980 ) { 259 header_height += 40; 260 } 261 262 if ( is_pb_fullwidth_section_first ) { 263 // If the first section is fullwidth, restore the padding-top modified area at first section 264 $et_pb_first_row.css({ 265 'paddingTop' : '0', 266 }); 267 } 268 269 if ( is_post_pb_full_layout_has_title ) { 270 271 // Add header height to post meta wrapper as padding top 272 $et_main_content_first_row_meta_wrapper.css({ 273 'paddingTop' : header_height 274 }); 275 276 } else if ( is_post_pb_full_layout_no_title ) { 277 278 $et_pb_first_row.css({ 279 'paddingTop' : header_height 280 }); 281 282 } else { 283 284 // Add header height to first row content as padding top 285 $et_main_content_first_row.css({ 286 'paddingTop' : header_height 287 }); 288 289 } 290 291 } else if ( is_pb_fullwidth_section_first ){ 292 293 /* Desktop / Mobile + Pagebuilder + Fullwidth Section */ 294 295 var $et_pb_first_row_first_module = $et_pb_first_row.children( '.et_pb_module:first' ); 296 297 // Quirks: If this is post with fullwidth layout + no title + fullwidth section at first row, 298 // Remove the added height at line 2656 299 if ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first && et_window_width > 980 ) { 300 header_height = header_height - 58; 301 } 302 303 if ( $et_pb_first_row_first_module.is( '.et_pb_slider' ) ) { 304 305 /* Desktop / Mobile + Pagebuilder + Fullwidth slider */ 306 307 var $et_pb_first_row_first_module_slide_image = $et_pb_first_row_first_module.find( '.et_pb_slide_image' ), 308 $et_pb_first_row_first_module_slide = $et_pb_first_row_first_module.find( '.et_pb_slide' ), 309 $et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module.find( '.et_pb_slide .et_pb_container' ), 310 et_pb_slide_image_margin_top = 0 - ( parseInt( $et_pb_first_row_first_module_slide_image.height() ) / 2 ), 311 et_pb_slide_container_height = 0, 312 $et_pb_first_row_first_module_slider_arrow = $et_pb_first_row_first_module.find( '.et-pb-slider-arrows a'), 313 et_pb_first_row_slider_arrow_height = $et_pb_first_row_first_module_slider_arrow.height(); 314 315 // Adding padding top to each slide so the transparency become useful 316 $et_pb_first_row_first_module_slide.css({ 317 'paddingTop' : header_height, 318 }); 319 320 // delete container's min-height 321 $et_pb_first_row_first_module_slide_container.css({ 322 'min-height' : '' 323 }); 324 325 // Adjusting slider's image, considering additional top padding of slideshow 326 $et_pb_first_row_first_module_slide_image.css({ 327 'marginTop' : et_pb_slide_image_margin_top 328 }); 329 330 // Adjusting slider's arrow, considering additional top padding of slideshow 331 $et_pb_first_row_first_module_slider_arrow.css({ 332 'marginTop' : ( ( header_height / 2 ) - ( et_pb_first_row_slider_arrow_height / 2 ) ) 333 }); 334 335 // Looping the slide and get the highest height of slide 336 et_pb_first_row_slide_container_height_new = 0 337 338 $et_pb_first_row_first_module.find( '.et_pb_slide' ).each( function(){ 339 var $et_pb_first_row_first_module_slide_item = $(this), 340 $et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module_slide_item.find( '.et_pb_container' ); 341 342 // Make sure that the slide is visible to calculate correct height 343 $et_pb_first_row_first_module_slide_item.show(); 344 345 // Remove existing inline css to make sure that it calculates the height 346 $et_pb_first_row_first_module_slide_container.css({ 'min-height' : '' }); 347 348 var et_pb_first_row_slide_container_height = $et_pb_first_row_first_module_slide_container.innerHe
348ight(); 349 350 if ( et_pb_first_row_slide_container_height_new < et_pb_first_row_slide_container_height ){ 351 et_pb_first_row_slide_container_height_new = et_pb_first_row_slide_container_height; 352 } 353 354 // Hide the slide back if it isn't active slide 355 if ( $et_pb_first_row_first_module_slide_item.is( ':not(".et-pb-active-slide")' ) ){ 356 $et_pb_first_row_first_module_slide_item.hide(); 357 } 358 }); 359 360 // Setting appropriate min-height, considering additional top padding of slideshow 361 $et_pb_first_row_first_module_slide_container.css({ 362 'min-height' : et_pb_first_row_slide_container_height_new 363 }); 364 365 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_header' ) ) { 366 367 /* Desktop / Mobile + Pagebuilder + Fullwidth header */ 368 369 // Remove existing inline stylesheet to prevent looping padding 370 $et_pb_first_row_first_module.removeAttr( 'style' ); 371 372 // Get paddingTop from stylesheet 373 var et_pb_first_row_first_module_fullwidth_header_padding_top = parseInt( $et_pb_first_row_first_module.css( 'paddingTop' ) ); 374 375 // Implement stylesheet's padding-top + header_height 376 $et_pb_first_row_first_module.css({ 377 'paddingTop' : ( header_height + et_pb_first_row_first_module_fullwidth_header_padding_top ) 378 } ); 379 380 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_portfolio' ) ) { 381 382 /* Desktop / Mobile + Pagebuilder + Fullwidth Portfolio */ 383 384 $et_pb_first_row_first_module.css({ 'paddingTop' : header_height }); 385 386 } else if ( $et_pb_first_row_first_module.is( '.et_pb_map_container' ) ) { 387 388 /* Desktop / Mobile + Pagebuilder + Fullwidth Map */ 389 390 var $et_pb_first_row_map = $et_pb_first_row_first_module.find( '.et_pb_map' ); 391 392 // Remove existing inline height to prevent looping height calculation 393 $et_pb_first_row_map.css({ 'height' : '' }); 394 395 // Implement map height + header height 396 $et_pb_first_row_first_module.find('.et_pb_map').css({ 397 'height' : header_height + parseInt( $et_pb_first_row_map.css( 'height' ) ) 398 }); 399 400 // Adding specific class to mark the map as first row section element 401 $et_pb_first_row_first_module.addClass( 'et_beneath_transparent_nav' ); 402 403 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_menu' ) ) { 404 405 /* Desktop / Mobile + Pagebuilder + Fullwidth Menu */ 406 $et_pb_first_row_first_module.css({ 'marginTop' : header_height }); 407 408 } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_code' ) ) { 409 410 /* Desktop / Mobile + Pagebuilder + Fullwidth code */ 411 412 var $et_pb_first_row_first_module_code = $et_pb_first_row_first_module; 413 414 $et_pb_first_row_first_module_code.css({ 'paddingTop' : '' }); 415 416 var et_pb_first_row_first_module_code_padding_top = parseInt( $et_pb_first_row_first_module_code.css( 'paddingTop' ) ); 417 418 $et_pb_first_row_first_module_code.css({ 419 'paddingTop' : header_height + et_pb_first_row_first_module_code_padding_top 420 }); 421 422 } else if ( $et_pb_first_row_first_module.is( '.et_pb_post_title' ) ) { 423 424 /* Desktop / Mobile + Pagebuilder + Fullwidth Post Title */ 425 426 var $et_pb_first_row_first_module_title = $et_pb_first_row_first_module; 427 428 $et_pb_first_row_first_module_title.css({ 429 'paddingTop' : header_height + 50 430 }); 431 } 432 433 } else if ( is_pb ) { 434 435 /* Desktop / Mobile + Pagebuilder + Regular section */ 436 437 // Remove first row's inline padding top styling to prevent looping padding-top calculation 438 $et_pb_first_row.css({ 'paddingTop' : '' }); 439 440 // Pagebuilder ignores #main-content .container's fixed height and uses its row's padding 441 // Anticipate the use of custom section padding. 442 et_pb_first_row_padding_top = header_height + parseInt( $et_pb_first_row.css( 'paddingBottom' ) ); 443 444 // Implementing padding-top + header_height 445 $et_pb_first_row.css({ 446 'paddingTop' : et_pb_first_row_padding_top 447 }); 448 449 } else if ( is_no_pb_mobile ) { 450 451 // Mobile + not pagebuilder 452 $et_main_content_first_row.css({ 453 'paddingTop' : header_height 454 }); 455 456 } else { 457 458 $('#main-content .container:first-child').css({ 459 'paddingTop' : header_height 460 }); 461 462 } 463 464 // Set #page-container's padding-top to zero after inline styling first row's content has been added 465 if ( ! $('#et_fix_page_container_position').length ){ 466 $( '<style />', { 467 'id' : 'et_fix_page_container_position', 468 'text' : '#page-container{ padding-top: 0 !important;}' 469 }).appendTo('head'); 470 } 471 472 } else if( et_is_fixed_nav ) { 473 474 $main_container_wrapper.css( 'paddingTop', header_height ); 475 476 } 477 478 et_change_primary_nav_position( 0 ); 479 } 480 481 $( window ).resize( function(){ 482 var window_width = $et_window.width(),
483 et_container_css_width = $et_container.css( 'width' ), 484 et_container_width_in_pixel = ( typeof et_container_css_width !== 'undefined' ) ? et_container_css_width.substr( -1, 1 ) !== '%' : '', 485 et_container_actual_width = ( et_container_width_in_pixel ) ? $et_container.width() : ( ( $et_container.width() / 100 ) * window_width ), // $et_container.width() doesn't recognize pixel or percentage unit. It's our duty to understand what it returns and convert it properly 486 containerWidthChanged = et_container_width !== et_container_actual_width; 487 488 if ( et_is_fixed_nav && containerWidthChanged ) { 489 if ( typeof update_page_container_position != 'undefined' ){ 490 clearTimeout( update_page_container_position ); 491 } 492 493 var update_page_container_position = setTimeout( function() { 494 et_fix_page_container_position(); 495 if ( typeof et_fix_fullscreen_section === 'function' ) { 496 et_fix_fullscreen_section(); 497 } 498 }, 200 ); 499 } 500 501 if ( et_hide_nav ) { 502 et_hide_nav_transofrm(); 503 } 504 505 if ( $( '#wpadminbar' ).length && et_is_fixed_nav && window_width >= 740 && window_width <= 782 ) { 506 et_calculate_header_values(); 507 508 et_change_primary_nav_position( 0 ); 509 } 510 511 et_set_search_form_css(); 512 } ); 513 514 $( window ).ready( function(){ 515 if ( $.fn.fitVids ) { 516 $( '#main-content' ).fitVids( { customSelector: "iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"} ); 517 } 518 } ); 519 520 $( window ).load( function(){ 521 if ( et_is_fixed_nav ) { 522 et_calculate_header_values(); 523 } 524 525 et_fix_page_container_position(); 526 527 if ( et_header_style_left && !et_vertical_navigation) { 528 $logo_width = $( '#logo' ).width(); 529 if ( et_is_rtl ) { 530 $et_top_navigation.css( 'padding-right', $logo_width + 30 ); 531 } else { 532 $et_top_navigation.css( 'padding-left', $logo_width + 30 ); 533 } 534 } 535 536 if ( $('p.demo_store').length ) { 537 $('#footer-bottom').css('margin-bottom' , $('p.demo_store').innerHeight()); 538 } 539 540 if ( $.fn.waypoint ) { 541 if ( et_is_vertical_fixed_nav ) { 542 var $waypoint_selector = $('#main-content'); 543 544 $waypoint_selector.waypoint( { 545 handler : function( direction ) { 546 et_fix_logo_transition(); 547 548 if ( direction === 'down' ) { 549 $('#main-header').addClass( 'et-fixed-header' ); 550 } else { 551 $('#main-header').removeClass( 'et-fixed-header' ); 552 } 553 } 554 } ); 555 } 556 557 if ( et_is_fixed_nav ) { 558 559 if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_pb_first_row.length ){ 560 561 // Fullscreen section at the first row requires specific adjustment 562 if ( $et_pb_first_row.is( '.et_pb_fullwidth_section' ) ){ 563 var $waypoint_selector = $et_pb_first_row.children('.et_pb_module'); 564 } else { 565 var $waypoint_selector = $et_pb_first_row.find('.et_pb_row'); 566 } 567 } else if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_main_content_first_row.length ) { 568 var $waypoint_selector = $('#content-area'); 569 } else { 570 var $waypoint_selector = $('#main-content'); 571 } 572 573 $waypoint_selector.waypoint( { 574 offset: function() { 575 if ( etRecalculateOffset ) { 576 setTimeout( function() { 577 et_calculate_header_values(); 578 }, 200 ); 579 580 etRecalculateOffset = false; 581 } 582 if ( et_hide_nav ) { 583 return et_header_offset - et_header_height - 200; 584 } else { 585 586 // Transparent nav modification: #page-container's offset is set to 0. Modify et_header_offset's according to header height 587 var waypoint_selector_offset = $waypoint_selector.offset(); 588 589 if ( waypoint_selector_offset.top < et_header_offset ) { 590 et_header_offset = 0 - ( et_header_offset - waypoint_selector_offset.top ); 591 } 592 593 return et_header_offset; 594 } 595 }, 596 handler : function( direction ) { 597 et_fix_logo_transition(); 598 599 if ( direction === 'down' ) { 600 $main_header.addClass( 'et-fixed-header' ); 601 $main_container_wrapper.addClass ( 'et-animated-content' ); 602 $top_header.addClass( 'et-fixed-header' ); 603 604 if ( ! et_hide_nav && ! $et_transparent_nav.length && ! $( '.mobile_menu_bar' ).is(':visible') ) { 605 var secondary_nav_height = $top_header.height(), 606 et_is_vertical_nav = $( 'body' ).hasClass( 'et_vertical_nav' ), 607 $clone_header, 608 clone_header_height, 609 fix_padding; 610 611 $clone_header = $main_header.clone().addClass( 'et-fixed-header, et_header_clone' ).css( { 'transition': 'none', 'display' : 'none' } ); 612 613 clone_header_height = $clone_header.prependTo( 'body' ).height(); 614 615 // Vertical nav doesn't need #page-container margin-top adjustment 616 if ( ! et_is_vertical_nav ) { 617 fix_padding = parseInt( $main_container_wrapper.css( 'padding-top' ) ) - clone_header_height - secondary_nav_height + 1 ; 618 619 $main_container_wrapper.css( 'margin-top', -fix_padding ); 620 } 621 622 $( '.et_header_clone' ).remove(); 623 } 624 625 } else { 626 $main_header.removeClass( 'et-fixed-header' ); 627 $top_header.removeClass( 'et-fixed-header' ); 628 $main_container_wrapper.css( 'margin-top', '-1px' ); 629 } 630 setTimeout( function() { 631 et_set_search_form_css(); 632 }, 400 ); 633 } 634 } ); 635 } 636 637 if ( et_hide_nav ) { 638 et_hide_nav_transofrm(); 639 } 640 } 641 } ); 642 643 $( 'a[href*=#]:not([href=#])' ).click( function() { 644 if ( ( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname ) && ! ( $( this ).closest( '.woocommerce-tabs' ).length && $( this ).closest( '.tabs' ).length ) ) { 645 var target = $( this.hash ); 646 target = target.length ? target : $( '[name=' + this.hash.slice(1) +']' ); 647 if ( target.length ) { 648 649 et_pb_smooth_scroll( target, false, 800 ); 650 651 if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) { 652 setTimeout(function(){ 653 et_pb_smooth_scroll( target, false, 40, 'linear' ); 654 }, 780 ); 655 } 656 657 return false;
658 } 659 } 660 }); 661 662 if ( $( '.et_pb_section' ).length > 1 && $( '.et_pb_side_nav_page' ).length ) { 663 var $i=0; 664 665 $( '#main-content' ).append( '<ul class="et_pb_side_nav"></ul>' ); 666 667 $( '.et_pb_section' ).each( function(){ 668 if ( $( this ).height() > 0 ) { 669 $active_class = $i == 0 ? 'active' : ''; 670 $( '.et_pb_side_nav' ).append( '<li class="side_nav_item"><a href="#" id="side_nav_item_id_' + $i + '" class= "' + $active_class + '">' + $i + '</a></li>' ); 671 $( this ).addClass( 'et_pb_scroll_' + $i ); 672 $i++; 673 } 674 }); 675 676 $side_nav_offset = ( $i * 20 + 40 ) / 2; 677 $( 'ul.et_pb_side_nav' ).css( 'marginTop', '-' + parseInt( $side_nav_offset) + 'px' ); 678 $( '.et_pb_side_nav' ).addClass( 'et-visible' ); 679 680 681 $( '.et_pb_side_nav a' ).click( function(){ 682 $top_section = ( $( this ).text() == "0" ) ? true : false; 683 $target = $( '.et_pb_scroll_' + $( this ).text() ); 684 685 et_pb_smooth_scroll( $target, $top_section, 800); 686 687 if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) { 688 setTimeout(function(){ 689 et_pb_smooth_scroll( $target, $top_section, 200); 690 },500); 691 } 692 693 return false; 694 }); 695 696 $( window ).scroll( function(){ 697 698 $add_offset = ( $( 'body' ).hasClass( 'et_fixed_nav' ) ) ? 20 : -90; 699 700 if ( $ ( '#wpadminbar' ).length && $( window ).width() > 600 ) { 701 $add_offset += $( '#wpadminbar' ).outerHeight(); 702 } 703 704 $side_offset = ( $( 'body' ).hasClass( 'et_vertical_nav' ) ) ? $( '#top-header' ).height() + $add_offset + 60 : $( '#top-header' ).height() + $( '#main-header' ).height() + $add_offset; 705 706 for ( var $i = 0; $i <= $( '.side_nav_item a' ).length - 1; $i++ ) { 707 if ( $( window ).scrollTop() + $( window ).height() == $( document ).height() ) { 708 $last = $( '.side_nav_item a' ).length - 1; 709 $( '.side_nav_item a' ).removeClass( 'active' ); 710 $( 'a#side_nav_item_id_' + $last ).addClass( 'active' ); 711 } else { 712 if ( $( this ).scrollTop() >= $( '.et_pb_scroll_' + $i ).offset().top - $side_offset ) { 713 $( '.side_nav_item a' ).removeClass( 'active' ); 714 $( 'a#side_nav_item_id_' + $i ).addClass( 'active' ); 715 } 716 } 717 } 718 }); 719 } 720 721 if ( $('.et_pb_scroll_top').length ) { 722 $(window).scroll(function(){ 723 if ($(this).scrollTop() > 800) { 724 $('.et_pb_scroll_top').show().removeClass( 'et-hidden' ).addClass( 'et-visible' ); 725 } else { 726 $('.et_pb_scroll_top').removeClass( 'et-visible' ).addClass( 'et-hidden' ); 727 } 728 }); 729 730 //Click event to scroll to top 731 $('.et_pb_scroll_top').click(function(){ 732 $('html, body').animate({scrollTop : 0},800); 733 }); 734 } 735 736 if ( $( '.comment-reply-link' ).length ) { 737 $( '.comment-reply-link' ).addClass( 'et_pb_button' ); 738 } 739 740 $( '#et_top_search' ).click( function() { 741 var $search_container = $( '.et_search_form_container' ); 742 743 $( '.et_menu_container' ).removeClass( 'et_pb_menu_visible' ).removeClass( 'et_pb_no_animation' ).addClass('et_pb_menu_hidden'); 744 $search_container.removeClass( 'et_pb_search_form_hidden' ).removeClass( 'et_pb_no_animation' ).addClass('et_pb_search_visible'); 745 setTimeout( function() { 746 $( '.et_menu_container' ).addClass( 'et_pb_no_animation' ); 747 $search_container.addClass( 'et_pb_no_animation' ); 748 }, 1000); 749 $search_container.find( 'input' ).focus(); 750 751 et_set_search_form_css(); 752 }); 753 754 function et_hide_search() { 755 $( '.et_menu_container' ).removeClass('et_pb_menu_hidden').removeClass( 'et_pb_no_animation' ).addClass( 'et_pb_menu_visible' ); 756 $( '.et_search_form_container' ).removeClass('et_pb_search_visible').removeClass( 'et_pb_no_animation' ).addClass( 'et_pb_search_form_hidden' ); 757 setTimeout( function() { 758 $( '.et_menu_container' ).addClass( 'et_pb_no_animation' ); 759 $( '.et_search_form_container' ).addClass( 'et_pb_no_animation' ); 760 }, 1000); 761 } 762 763 function et_set_search_form_css() { 764 var $search_container = $( '.et_search_form_container' ); 765 var $body = $( 'body' ); 766 if ( $search_container.hasClass( 'et_pb_search_visible' ) ) { 767 var header_height = $( '#main-header' ).innerHeight(), 768 menu_width = $( '#top-menu' ).width(), 769 font_size = $( '#top-menu li a' ).css( 'font-size' ); 770 $search_container.css( { 'height' : header_height + 'px' } );
771 $search_container.find( 'input' ).css( 'font-size', font_size ); 772 if ( ! $body.hasClass( 'et_header_style_left' ) ) { 773 $search_container.css( 'max-width', menu_width + 60 ); 774 } else { 775 $search_container.find( 'form' ).css( 'max-width', menu_width + 60 ); 776 } 777 } 778 } 779 780 $( '.et_close_search_field' ).click( function() { 781 et_hide_search(); 782 }); 783 784 $( document ).mouseup( function(e) { 785 var $header = $( '#main-header' ); 786 if ( $( '.et_menu_container' ).hasClass('et_pb_menu_hidden') ) { 787 if ( ! $header.is( e.target ) && $header.has( e.target ).length === 0 ) { 788 et_hide_search(); 789 } 790 } 791 }); 792 793 // Detect actual logo dimension, used for tricky fixed navigation transition 794 function et_define_logo_dimension() { 795 var $logo = $('#logo'), 796 logo_src = $logo.attr( 'src' ), 797 is_svg = logo_src.substr( -3, 3 ) === 'svg' ? true : false, 798 $logo_wrap, 799 logo_width, 800 logo_height; 801 802 // Append invisible wrapper at the bottom of the page 803 $('body').append( $('<div />', { 804 'id' : 'et-define-logo-wrap', 805 'style' : 'position: fixed; bottom: 0; opacity: 0;' 806 })); 807 808 // Define logo wrap 809 $logo_wrap = $('#et-define-logo-wrap'); 810 811 if( is_svg ) { 812 $logo_wrap.addClass( 'svg-logo' ); 813 } 814 815 // Clone logo to invisible wrapper 816 $logo_wrap.html( $logo.clone().css({ 'display' : 'block' }).removeAttr( 'id' ) ); 817 818 // Get dimension 819 logo_width = $logo_wrap.find('img').width(); 820 logo_height = $logo_wrap.find('img').height(); 821 822 // Add data attribute to $logo 823 $logo.attr({ 824 'data-actual-width' : logo_width, 825 'data-actual-height' : logo_height 826 }); 827 828 // Destroy invisible wrapper 829 $logo_wrap.remove(); 830 831 // Init logo transition onload 832 et_fix_logo_transition( true ); 833 } 834 835 if ( $('#logo').length ) { 836 et_define_logo_dimension(); 837 } 838 839 // Set width for adsense in footer widget 840 $('.footer-widget').each(function(){ 841 var $footer_widget = $(this), 842 footer_widget_width = $footer_widget.width(), 843 $adsense_ins = $footer_widget.find( '.widget_adsensewidget ins' ); 844 845 if ( $adsense_ins.length ) { 846 $adsense_ins.width( footer_widget_width ); 847 } 848 }); 849 } ); 850 851 // Fixing logo size transition in tricky header style 852 function et_fix_logo_transition( is_onload ) { 853 var $body = $( 'body' ), 854 $logo = $( '#logo' ), 855 logo_actual_width = parseInt( $logo.attr( 'data-actual-width' ) ), 856 logo_actual_height = parseInt( $logo.attr( 'data-actual-height' ) ), 857 logo_height_percentage = parseInt( $logo.attr( 'data-height-percentage' ) ), 858 $top_nav = $( '#et-top-navigation' ), 859 top_nav_height = parseInt( $top_nav.attr( 'data-height' ) ), 860 top_nav_fixed_height = parseInt( $top_nav.attr( 'data-fixed-height' ) ), 861 $main_header = $('#main-header'), 862 is_header_split = $body.hasClass( 'et_header_style_split' ), 863 is_fixed_nav = $main_header.hasClass( 'et-fixed-header' ), 864 is_vertical_nav = $body.hasClass( 'et_vertical_nav' ), 865 is_hide_primary_logo = $body.hasClass( 'et_hide_primary_logo' ), 866 is_hide_fixed_logo = $body.hasClass( 'et_hide_fixed_logo' ), 867 is_onload = typeof is_onload === 'undefined' ? false : is_onload, 868 logo_height_base = is_fixed_nav ? top_nav_height : top_nav_fixed_height, 869 logo_wrapper_width, 870 logo_wrapper_height; 871 872 // Fix for inline centered logo in horizontal nav 873 if ( is_header_split && ! is_vertical_nav ) { 874 // On page load, logo_height_base should be top_nav_height 875 if ( is_onload ) { 876 logo_height_base = top_nav_height; 877 } 878 879 // Calculate logo wrapper height 880 logo_wrapper_height = ( logo_height_base * ( logo_height_percentage / 100 ) + 22 ); 881 882 // Calculate logo wrapper width 883 logo_wrapper_width = logo_actual_width * ( logo_wrapper_height / logo_actual_height ); 884 885 // Override logo wrapper width to 0 if it is hidden 886 if ( is_hide_primary_logo && ( is_fixed_nav || is_onload ) ) { 887 logo_wrapper_width = 0; 888 } 889 890 if ( is_hide_fixed_logo && ! is_fixed_nav && ! is_onload ) { 891 logo_wrapper_width = 0; 892 } 893
894 // Set fixed width for logo wrapper to force correct dimension 895 $( '.et_header_style_split .centered-inline-logo-wrap' ).css( { 'width' : logo_wrapper_width } ); 896 } 897 } 898})(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.