Created
June 10, 2020 10:15
-
-
Save Pebblo/49c55ce8f85ec01fb58a9edcb03176e2 to your computer and use it in GitHub Desktop.
Example of how to override a JS method added by espresso_core.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Please do not include the opening PHP tag if you already have one | |
function tw_ee_override_espresso_core(){ | |
wp_add_inline_script( | |
'espresso_core', | |
"jQuery(document).ready(function($){ | |
$.fn.extend({ | |
eeAddOverlay : function( opacity ) { | |
console.log('Testing'); | |
opacity = typeof opacity === 'undefined' || opacity > 1 ? 0.5 : opacity; | |
var overlay = '<div id=\"ee-overlay\"></div>'; | |
$(overlay).appendTo('body').css({ | |
'position' : 'fixed', | |
'top' : 0, | |
'left' : 0, | |
'width' : '100%', | |
'height' : '100%', | |
'background' : '#000', | |
'opacity' : opacity, | |
'filter' : 'alpha(opacity=' + ( opacity * 100 ) + ')', | |
'z-index' : 10000 | |
}); | |
return this; | |
} | |
}); | |
});" | |
); | |
} | |
add_action( 'wp_print_footer_scripts', 'tw_ee_override_espresso_core', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment