npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

totem.module.top-bar

v2.8.2

Published

Totem Module for displaying a sticky top bar

Downloads

9

Readme

Totem module: Top bar

Totem Module for displaying a sticky header

This module is created for Totem projects but can also be used in any other Twig related project.

Installation

Install totem.module.top-bar with npm (we assume you have pre-installed node.js).

$ npm install totem.module.top-bar --save

Setup

Import all stylesheets within ITCSS order from your project stylesheet:

@import "...node_modules/totem.module.top-bar/stylesheets/shared/**";
@import "...node_modules/totem.module.top-bar/stylesheets/helpers/**";
@import "...node_modules/totem.module.top-bar/stylesheets/settings/**";
@import "...node_modules/totem.module.top-bar/stylesheets/tools/**";
@import "...node_modules/totem.module.top-bar/stylesheets/properties/**";
@import "...node_modules/totem.module.top-bar/stylesheets/generic/**";
@import "...node_modules/totem.module.top-bar/stylesheets/base/**";
@import "...node_modules/totem.module.top-bar/stylesheets/objects/**";
@import "...node_modules/totem.module.top-bar/stylesheets/components/**";
@import "...node_modules/totem.module.top-bar/stylesheets/utilities/**";

Next you must import jQuery before you can init the top bar module. You can use the following example if your working withing a Totem project*:

var $ = require('jquery'); //Require jQuery from Node with Browserify
window.jQuery = $; // Define the jQuery namespace as a global variable.

require('totem.module.top-bar'); //Require jQuery from Node with Browserify

$(function() {
    setTopBar(); // Init Top Bar
})
  • Since we're requiring the above dependencies with Browserify you should only include the above example.

CSS Options

You can enable/disable certain settings from stylesheets/settings/_settings.top-bar-features.scss:

$top-bar-features: (
    'is-sticky': true, // Set the position to absolute or fixed
    'can-autohide': true, // Enable/disable autohide behaviour if the scroll position is larger than our the top-bar offset + height
    'can-peek': true // Enable/disable peek behaviour when scrolling upwards
) !default;

is-sticky

By default, the top bar element will stick to the top of the viewport by using position: absolute. You can change this behaviour by changing the key is-sticky within the $top-bar-features Sass map.

can-autohide

By default, the top bar element will autohide when the scrolk position of the viewport is greater than the vertical position & outerheight of the top bar. You can change this behaviour by changing the key can-autohide within the $top-bar-features Sass map.

can-peek

By default, the top bar element will show when scrolling upwards after it faded out. You can change this behaviour by changing the key can-peek within the $top-bar-features Sass map.

JS Options

Custom push element

By default, the top bar script will generate a push element so it won't overlap any content. You can define a custom element that will be used as push element.

setTopBar(
    $('.my-custom-push') // Will set the height of every .my-custom-push element to the top bar's height
);

Custom trigger position

By default, the top bar will trigger some classes based on the viewports scroll position:

  1. Small - Uses the class: .js__top-bar--small to the top bar wich can be used for styling purposes. This class will be added if the viewports scrolltop is higher than the top bar element position + outerheight
  2. Autohide - Uses the class: .js__top-bar--autohide to hide the top bar element. This class will be added if the viewports scrolltop is higher than the top bar element position + (outerheight * times 2).

You can adjust the trigger position by defining a custom trigger element

setTopBar(
    undefined, //Push Element is not used in this examle
    $('.my-custom-trigger') // The top bar will trigger it's classes when the user scrolls passed this element
);

Styling

This module only offers some base styling (e.g. autodhide & sticky position). Any other styles should be defined from any child element within the top bar.