[Resolved] Sticky Sidebar

Home Forums Support [Resolved] Sticky Sidebar

Home Forums Support Sticky Sidebar

  • This topic has 38 replies, 13 voices, and was last updated 5 years ago by Leo.
Viewing 15 posts - 1 through 15 (of 39 total)
  • Author
    Posts
  • #119309
    kane

    Hi,

    thank you for the great theme.

    is it possible to make the whole sidebar sticky?

    The last element should float to the beginning of the footer-section.

    Greetings

    #119391
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Give this plugin a try: https://wordpress.org/plugins/sticky-menu-or-anything-on-scroll/

    The right sidebar element is: #right-sidebar

    Left sidebar is: #left-sidebar

    Let me know if you have any questions 🙂

    #119406
    kane

    Hi Tom,

    thank you for your advice, but the plugin doesnt work properly.

    it floats over the footer-section. this doesnt look good.

    Maybe there is a solution without plugins?

    #119530
    Tom
    Lead Developer
    Lead Developer

    Not an easy one unfortunately – you could try integrating a jQuery plugin like this: https://github.com/leafo/sticky-kit

    #119601
    kane

    Hi Tom,

    i have tried your solution with the sticky kit, but i didnt work.

    Maybe you can give me an advice.

    1. copied the jquery.sticky-kit.min.js in my folder “child-theme/js/jquery.sticky-kit.min.js”

    2. I have added following code in the footer.php of my child theme

    <script type=”text/javascript” src=”js/jquery.sticky-kit.min.js”>
    $(document).ready(function(){
    $(“#right-sidebar”).stick_in_parent();
    });
    </script>

    But still doesnt work….

    thanky you

    #119644
    Tom
    Lead Developer
    Lead Developer

    Almost!

    Add this to your functions.php:

    add_action( 'wp_enqueue_scripts', 'generate_custom_scripts' );
    function generate_custom_scripts() {
    	wp_enqueue_script(
    		'custom-script',
    		get_stylesheet_directory_uri() . '/js/jquery.sticky-kit.js',
    		array( 'jquery' )
    	);
    }

    Then add this to wp_footer (using GP Hooks):

    <script>
          jQuery(document).ready(function( $ ){
                $("#right-sidebar").stick_in_parent();
          });
    </script>
    #119773
    kane

    Hi Tom,

    thank you very much. you are the best

    Now it works perfect…

    greetings

    #119780
    Tom
    Lead Developer
    Lead Developer

    Awesome, glad I could help 🙂

    #169202
    Ingrid Wildschut

    I have done it all but it’s not working for me.
    I’m not working in a child theme is that te problem?

    Sorry i have make it work…

    • This reply was modified 9 years, 3 months ago by Ingrid Wildschut.
    #169371
    Tom
    Lead Developer
    Lead Developer

    Awesome! Glad you made it work 🙂

    #258554
    Drew

    I got this to work as well… however, only if I’m on a blog page.

    I created a homepage with a sidebar that I want to be sticky like this?

    Any thoughts?

    #258563
    Drew

    Scratch that… it seems to be working on all pages now.

    #258685
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working 🙂

    #258900
    BarnaB

    It didn’t work for me :/ Any tiny little chance this could be a new years surprise addon somehow ? 🙂 I was looking for the same without a plugin, but did all the above and didn’t work out :/

    #258923
    Tom
    Lead Developer
    Lead Developer

    Which method did you try? The plugin or the jQuery script?

Viewing 15 posts - 1 through 15 (of 39 total)
  • You must be logged in to reply to this topic.