Sticky Navbar
Permalink
Hi
I would really appreciate some help. I have a dropdown megamenu and I'm trying to make it stick to the top after scrolling. I've tried many instances of css and javascript but I just can't get it to work.
Many thanks if you can help.
I'm on Concrete5.8.4.2
I would really appreciate some help. I have a dropdown megamenu and I'm trying to make it stick to the top after scrolling. I've tried many instances of css and javascript but I just can't get it to work.
Many thanks if you can help.
I'm on Concrete5.8.4.2
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> * { box-sizing: border-box; } body { margin: 0; } .navbar { overflow: hidden; background-color: #fff; font-family: Arial, Helvetica, sans-serif;
Viewing 15 lines of 127 lines. View entire code block.
Hi Steevb
I've removed all the fixed, sticky and js as I can't get it to work. I've had it working without the dropdown but its a megamenu which is the whole point.
Many thanks for your help.
I've removed all the fixed, sticky and js as I can't get it to work. I've had it working without the dropdown but its a megamenu which is the whole point.
Many thanks for your help.
Hi Helvetica
I've played with it but it keeps freezing the editing interface. Annoying to keep revising versions.
Thanks for your help, I will keep trying.
I've played with it but it keeps freezing the editing interface. Annoying to keep revising versions.
Thanks for your help, I will keep trying.
I set up a quick demo with css below:
See attached movie, if it uploads?
.navbar { margin: 0; background-color: #fff; font-family: Arial, Helvetica, sans-serif; position: fixed; width:100%; top:0; border-bottom: 1px solid #f00 }
See attached movie, if it uploads?
Many thanks for that Steevb but I need it " stick " not fixed. The navbar has to ride over another element then stick to the top.
Where did you put the navbar btw. Mine breaks up ( its not in the autonav )
I think this will need js.
Tel
Where did you put the navbar btw. Mine breaks up ( its not in the autonav )
I think this will need js.
Tel
do you mean something like this: https://codyhouse.co/demo/secondary-fixed-navigation/index.html...
Well, That is very nice but it doesn't have a megamenu dropdown. That has been my problem.
Thanks Steevb
Thanks Steevb
1.) Copy jquery.sticky.min.js in your js folder.
2.) Make sure jquery.js is loaded.
3.) In the opening bracket of the header put:
4.) In the footer, before the </body> closing bracket put:
That gives you a «sticky» header for your purpose. check stickyjs.com to see how to «unstick» at a desired position.
2.) Make sure jquery.js is loaded.
3.) In the opening bracket of the header put:
<header id="fixed-header">
4.) In the footer, before the </body> closing bracket put:
<script src="<?php echo $view->getThemePath()?>/js/jquery.sticky.min.js"></script> <script> $(document).ready(function(){ $("#fixed-header").sticky({ topSpacing:0, }); }); </script>
That gives you a «sticky» header for your purpose. check stickyjs.com to see how to «unstick» at a desired position.
Use css: