Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // add this code in your child theme's functions.php file
- /*******************************************************************\
- |* sticky "Publish/Update" button on scroll in wp-admin edit pages *|
- \*******************************************************************/
- function sticky_admin_button_footer_function($data) {
- ?>
- <script>
- if (typeof(jQuery)!='undefined') {
- jQuery(document).ready(function($) {
- if ($('#publishing-action').length) {
- var akn_patop = 0;
- $(window).on('scroll',function() {
- if (!$('#publishing-action').hasClass('akn-sticky'))
- akn_patop = $('#publishing-action').offset().top-($('.woocommerce-layout__header-wrapper').height()||0)-($('#wpadminbar').height()||0)-30;
- if ($(window).scrollTop()>akn_patop) {
- $('#publishing-action').addClass('akn-sticky').css({'position':'fixed','right':'30px','top':($('.woocommerce-layout__header-wrapper').height()||0)+$('#wpadminbar').height()+30,'z-index':'1000'}).find('#publish').css({'box-shadow':'0 0 20px rgb(85,93,102)'});
- $('#delete-action').css({'margin-bottom':$('#publishing-action').height()+'px'});
- }
- else {
- $('#publishing-action').removeClass('akn-sticky').css({'position':'','right':'','top':'','z-index':''}).find('#publish').css({'box-shadow':''});
- $('#delete-action').css({'margin-bottom':''});
- }
- });
- $(window).trigger('scroll');
- }
- });
- }
- </script>
- <?php
- }
- add_action('admin_footer', 'sticky_admin_button_footer_function');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement