headroom.js | Give your pages some headroom Hide your header until you need it | Frontend Framework library

 by   WickyNilliams JavaScript Version: v0.11.0 License: MIT

kandi X-RAY | headroom.js Summary

kandi X-RAY | headroom.js Summary

headroom.js is a JavaScript library typically used in User Interface, Frontend Framework, React applications. headroom.js has no vulnerabilities, it has a Permissive License and it has medium support. However headroom.js has 1 bugs. You can install using 'npm i rwoody-headroom.js' or download it from GitHub, npm.

Headroom.js is a lightweight, high-performance JS widget (with no dependencies) that allows you to react to the user's scroll. The header on this site is a living example, it slides out of view when scrolling down and slides back in when scrolling up.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              headroom.js has a medium active ecosystem.
              It has 10870 star(s) with 857 fork(s). There are 198 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 15 open issues and 274 have been closed. On average issues are closed in 193 days. There are 12 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of headroom.js is v0.11.0

            kandi-Quality Quality

              headroom.js has 1 bugs (0 blocker, 0 critical, 0 major, 1 minor) and 0 code smells.

            kandi-Security Security

              headroom.js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              headroom.js code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              headroom.js is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              headroom.js releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.
              headroom.js saves you 101 person hours of effort in developing the same functionality from scratch.
              It has 257 lines of code, 0 functions and 12 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of headroom.js
            Get all kandi verified functions for this library.

            headroom.js Key Features

            No Key Features are available at this moment for headroom.js.

            headroom.js Examples and Code Snippets

            No Code Snippets are available at this moment for headroom.js.

            Community Discussions

            QUESTION

            Headroom.js navbrand and navlinks
            Asked 2020-Apr-12 at 23:31

            I am using Headroom.js in my bootstrap website, and so far so good, working fine the way i want. I have a question though: Is there anyway to change navbrand and customize navlinks when in "notTop"?! Let me be clearer, When fixed, i use a transparent navbar with a white version of the logo and white navlinks, BUT, when scrolled down, i need the navbar white transparent, navlinks darker/black and a black version of my logo. Most likely it can be done but i havent been able to find a solution for this. Thanks in advance.

            ...

            ANSWER

            Answered 2020-Apr-12 at 23:31

            Here is how you can achieve the desired effect. Simply apply styles based on top and notTop scenario. Run the working stack snippet below to see it in action.

            Source https://stackoverflow.com/questions/61132602

            QUESTION

            How to get an component height to trigger Headroom in React?
            Asked 2020-Jan-13 at 21:55

            This is my first time dealing with Gatsby and React, so I might be using the wrong approach on this matter. Anyway, this is what is going on.

            From the gatsby-starter-hello-world, I'm building this site that will be composed of a front page with a Hero on the top, holding the intro information. Right bellow, I'm intending to insert some content (I'm not sure about what yet), with this

            appearing on scroll. For that part, I'm intending on use Headroom.js, which already works in the site. The thing is I need it to be triggered only after the bottom of the Hero component touches the top of the viewport. And this will happen only in desktop and laptops. On mobile I intend to make it a fixed navbar.

            Anyway, right now, this is what I have for a Layout.js

            ...

            ANSWER

            Answered 2020-Jan-13 at 21:55

            Your Hero component would need to use forwardRef to pass the ref to the nearest React element:

            Source https://stackoverflow.com/questions/59723234

            QUESTION

            how to hide navigation menu bar on scroll down and it should appear on scrolling up using angularjs?
            Asked 2018-Jul-26 at 07:02

            How to hide navigation menu bar on scroll down and it should appear on scrolling up using angularjs? As I have seen a solution that library 'headroom.js' is quite useful but I am unable to implement.Please suggest an appropriate solution.

            ...

            ANSWER

            Answered 2017-Mar-23 at 15:16

            Thanks to this post: scroll up/down detection

            You can use this:

            Source https://stackoverflow.com/questions/42979992

            QUESTION

            Transparent background becomes black when changing from solid colour in Safari
            Asked 2017-Oct-06 at 12:44

            I use headroom.js to hide/show navbar on scroll. Works great. On scrolling up, nav has a solid background colour and when nav is at top, background should be transparent. No issues on Chrome but an issue with Safari.

            Markup:

            ...

            ANSWER

            Answered 2017-Oct-06 at 12:44

            Well for starters you have

            Source https://stackoverflow.com/questions/46605310

            QUESTION

            Show nav menu after scrolling up 50px
            Asked 2017-Sep-07 at 20:39

            I want to show a sticky menu nav when scrolling up while also having a delay before showing the nav menu. I can do this with animate and opacity, but it's not as effective.

            I tried to show the nav menu when scrolling up 50px from the current position, but it didn't work.

            Here's the script:

            ...

            ANSWER

            Answered 2017-Sep-07 at 17:59

            Your current setup only accounts for scrolls that are greater than headerOrgOffset. If you want the slide down to happen, you need to account for cases where the scroll is less than headerOrgOffset. Since you also want a 50px buffer, I've added a -50 in the else statement.

            Source https://stackoverflow.com/questions/46078005

            QUESTION

            How can I make visible my element when scroll to another element?
            Asked 2017-Jun-23 at 13:17

            I have #event div an it's a hidden div on my page When I scroll down my page if I near to my #event div then be visible.but when I scroll down to near my #event div then it becomes visible but there is a little bug because when I scroll down my div is shaking.

            so where is my mistake ?

            I see a plugin headroom.js but I don't want to use any plugin I want to do by myself.I guess it is a basic.

            footnote: my #event div is in center of the #page div with red background

            ...

            ANSWER

            Answered 2017-Jun-23 at 13:17

            This would solve your issue:

            Source https://stackoverflow.com/questions/44721268

            QUESTION

            Hide and show the navbar when scrolling up
            Asked 2017-Jun-22 at 18:12

            I would like to improve an existing code that allows me to show the navbar once the page is loaded and after the user scrolls down it disappears. I want to make the navbar appear every time the user scrolls up. Basically, I need a Headroom plugin, but as a pure javascript. I would consider any other simple alternatives.

            That's is some HTML and the Javascript itself:

            ...

            ANSWER

            Answered 2017-Jun-22 at 17:12

            If creating HTML is allowed, one can add the CSS styles required for Headroom through Javascript.

            Note: This only creates the CSS for Headroom; Headroom itself still must be loaded

            Examples using CSS on headroom.js examples

            Pure JS:

            Source https://stackoverflow.com/questions/44705096

            QUESTION

            Headroom.js header with initial static state
            Asked 2017-Jun-14 at 08:25

            I'm using the awesome Headroom.js plugin to build an auto-hiding header. The header is static from start and becomes pinned after an offset (when scrolling down) and then back to static (when it's back to the top).

            Here is what I have done: http://codepen.io/netgloo/pen/KmGpBL

            but I got 2 problems:

            • scrolling down from top: when the header becomes pinned, I see it slides down and suddenly slides up
            • scrolling up from middle page: when the header arrives to the offset it disappears, but I need keeping it pinned to the top

            Someone could give me some help or ideas? Thanks

            Here is how I initialize the plugin:

            ...

            ANSWER

            Answered 2017-Jun-10 at 14:14

            The headroom.js script mainly handles the addition/removal of some classes for you. It's up to you to add the appropriate styles to achieve the effect you want. Let's start with the simplest part, the HTML:

            HTML

            Source https://stackoverflow.com/questions/44055692

            QUESTION

            CSS performance - how to evaluate - animation (transition) of floating button size on scroll (transform scale vs height/width)
            Asked 2017-Mar-14 at 21:40

            Introductory information: I've made a fixed menu button to show the navigation menu when using a mobile device. For this application I'm using the Headroom.js script to make the button smaller when scrolling downwards to ensure that it doesn't block too much of the content. The animation/transition is applied by adding a class with the given changes.

            In the original method i changed the size and look of the button by changing height/width of the parent element and padding of the child element with CSS (and css transition).

            The new method, which I've read could/should be better according to various sites, is changing the size of the button by using transform: scale(). Note that i'm also moving the element a bit by also applying translate3d(20px,20px,0) in this method. However, it feels a bit smoother when scrolling using the transform: scale() method (could be a placebo effect though), but using chrome dev tools' timeline gives me seemingly inconclusive results.

            Therefore a part of my question is also how I should evaluate the best method. Is timeline in Chrome Dev tools the best option, or is there a better way to do it? And which elements of the timeline should I base my choices on? and the other thing is, based on your interpretation of the images and/or tests combined with your knowledge, which method performs the best (or should perform the best in theory)?

            Beneath you can see two examples of the timeline with each method. Changing height/width and padding (original method):





            Method using transform: scale() to change the size:

            Also you can try the different methods in fiddles here:
            link: Original method changing height/width and padding
            link to new method: using transform:scale

            Please ignore the poor layout of everything; especially the button. The ugly image inside the menu button is just to show, that there's an image included in the layout on my own page and to take that into performance considerations. The images in the back is also included since it's a webshop with a lot of images which could influence performance.

            CSS for added class that makes the changes in the original method:

            ...

            ANSWER

            Answered 2017-Mar-14 at 21:40

            I believe you are missing the point, Chris: the reason why no other property but transform and opacity should ever be animated is because they don't trigger a repaint in anything else, even if the element is in the document flow (and because you can basically do anything with these two alone in like 95% of the cases).

            From the "hit-on-performance" point of view, there are two types of animations:

            • those that trigger a repaint in other elements than the animated element
            • those that do not.

            That's the main reason behind recommending animations by transform, opacity or position:relative;left|right|top|left. Because they don't actually move the element in flow, thus not triggering a repaint to every single other element in flow after the one being animated.

            Now, if the said parent was positioned absolute (which I assume to be the case), it wouldn't have triggered a repaint to the rest of DOM anyway so the differences between that method and transform would have been minor. Inconclusive, as you put it. In theory, repainting two elements instead of one should be slower.

            If you need to test, make 10k clones and trigger animation on all of them, with each method.

            That will be conclusive.

            If you really want to min-max this (as in spend absurd amounts of time on hardly noticeable improvements, as I do) you will find plenty of resources that will recommend:

            • replacing any .animate() with .velocity()
            • never animating anything but transform or opacity, although Velocity claims they animate anything without a hit on performance (i find that debatable/arguable, at best) - but it's a net improvement over .animate()
            • sticking to CSS transitions, if possible (basically if you don't need chains)
            • using Web Animations API

            Personal advice: never count on synced CSS animations, especially when you have many of them. If you change tabs or the system does something extremely resource heavy for a while, your animations will be way off. If you need chains, chain.

            Source https://stackoverflow.com/questions/42795764

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install headroom.js

            Headroom.js is available on npm. To install:.
            After installing headroom.js. The following JS will create and initialise a headroom instance:.
            The following steps will get you setup to contribute changes to this repo:.
            Fork the repo (click the Fork button at the top right of this page)
            Clone your fork locally
            Install dependencies. This repo uses npm, so you should too.

            Support

            For complete documentation please visit the headroom.js website.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/WickyNilliams/headroom.js.git

          • CLI

            gh repo clone WickyNilliams/headroom.js

          • sshUrl

            git@github.com:WickyNilliams/headroom.js.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link