Search code examples
wordpressbuttonpublish

How to make the Publish button follow the page in wordpress?


I want to make the publish button follow the page (floating/sticky). Is there any way? Thanks, The Anh


Solution

  • I think you want to make the div element of the Publish or Update button stick to the page.

    To make a div element stick to the page you can use some solutions:

    1. CSS: Make the div of the button have position fixed property

    #submitdiv {position: fixed; z-index:999999}

    1. jQuery solution: use a jquery sticky plugin (http://stickyjs.com, http://someweblog.com/hcsticky-jquery-floating-sticky-plugin/). Then implement some it to #submitdiv element

    Stickyjs:

    $(document).ready(function(){
    $("#sticker").sticky({topSpacing:0});});
    

    hcSticky:

    $("#submitdiv").css('z-index','999999').hcSticky({noContainer:true});
    
    1. Use a wordpress plugin. I know a plugin that can help you: http://wordpress.org/plugins/floating-publish-button/. Please take a look.

    Hope this answer can help you.