EduardET

Untitled

Mar 4th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $( 'a[href*="#"]:not([href="#"])' ).click( function() {
  2.             var $this_link = $( this ),
  3.                 has_closest_smooth_scroll_disabled = $this_link.closest( '.et_smooth_scroll_disabled' ).length,
  4.                 has_closest_woocommerce_tabs = ( $this_link.closest( '.woocommerce-tabs' ).length && $this_link.closest( '.tabs' ).length ),
  5.                 has_closest_timetable_tab = $this_link.closest( '.tt_tabs_navigation' ).length,
  6.                 has_closest_eab_cal_link = $this_link.closest( '.eab-shortcode_calendar-navigation-link' ).length,
  7.                 has_closest_ee_cart_link = $this_link.closest( '.view-cart-lnk' ).length,
  8.                 has_acomment_reply = $this_link.hasClass( 'acomment-reply' ),
  9.                 is_woocommerce_review_link = $this_link.hasClass( 'woocommerce-review-link' ),
  10.                 calendar_next = $this_link.hasClass( 'frmcal-next' ),
  11.                 calendar_prev = $this_link.hasClass( 'frmcal-prev' ),
  12.                 disable_scroll = has_closest_smooth_scroll_disabled || has_closest_ee_cart_link || has_closest_woocommerce_tabs || has_closest_eab_cal_link || has_acomment_reply || is_woocommerce_review_link || has_closest_timetable_tab || calendar_prev || calendar_next;
  13.  
  14.             if ( ( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname ) && ! disable_scroll ) {
  15.                 var target = $( this.hash );
  16.                 target = target.length ? target : $( '[name=' + this.hash.slice(1) +']' );
  17.                 if ( target.length ) {
  18.  
  19.                     // automatically close fullscreen menu if clicked from there
  20.                     if ( $this_link.closest( '.et_pb_fullscreen_menu_opened' ).length > 0 ) {
  21.                         et_pb_toggle_fullscreen_menu();
  22.                     }
  23.  
  24.                     et_pb_smooth_scroll( target, false, 800 );
  25.  
  26.                     if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) {
  27.                         setTimeout(function(){
  28.                             et_pb_smooth_scroll( target, false, 40, 'linear' );
  29.                         }, 780 );
  30.                     }
  31.  
  32.                     return false;
  33.                 }
  34.             }
  35.         });
Advertisement
Add Comment
Please, Sign In to add comment