Archived topic
Sticky Sidebar
38 replies · Started by kane on July 7, 2015
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
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 :)
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?
Not an easy one unfortunately - you could try integrating a jQuery plugin like this: https://github.com/leafo/sticky-kit
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
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>
Hi Tom,
thank you very much. you are the best
Now it works perfect...
greetings
Awesome, glad I could help :)
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...
Awesome! Glad you made it work :)
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?
Scratch that... it seems to be working on all pages now.
Glad you got it working :)
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 :/
Which method did you try? The plugin or the jQuery script?