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

@groftware/fullscreen-horizontal-scroll

v1.0.3

Published

A component that has fullscreen experience and scrolls content horizontally with vertical scroll

Downloads

3

Readme

Table of contents

A component that helps developer to create an element that scroll horizontally using vertical scroll with fullscreen view. It only starts to scroll horizontally when the scroll/view reaches the element.

  • It is reponsive, scrolling works on all screen sizes 📱💻🖥
  • It only scrolls horizontally when it reaches the element, no unwated horizontal scrolling when user are browsing your website
  • Solve your problem to do the calculation for scrolling horizontally with vertical scroll 🤓
  • Scrolls horitonzally as accurate as your vertical scroll 🖱

Installation

npm i @groftware/fullscreen-horizontal-scroll 

or

yarn add @groftware/fullscreen-horizontal-scroll 

Why make such a component?

We wanted to have this feature for our website, but we couldn't find anything similar.

How it works?

It takes the children width in containers and apply the height to the wrapper. So when user scrolls vertically, it uses HTML DOM property; which is scrollLeft, to mimic the horizontal scroll.

Usage

Just wrap the element that you want it to scroll horizontally <FullScreenHorizontalScroll> you are good to go! 🎉

Example:

import FullScreenHorizontalScroll from '@groftware/fullscreen-horizontal-scroll';

<div>
  <div style={{ backgroundColor: 'black', width: 1500, height: 100 }} />
  <FullScreenHorizontalScroll>
    {/* Elements that you want to display in the horizontal scroll */}
    <div style={{ border: '10px solid black', height: 200 }}>
      <div style={{ border: '10px solid red', width: 1500, height: 100 }} />
    </div>
    <div style={{ border: '10px solid black', width: 1500, height: 100 }} />
  </FullScreenHorizontalScroll>
  <div style={{ backgroundColor: 'black', width: 1500, height: 100 }} />
</div>

FAQ

  1. Why is my element stretched to window height?

    The container uses display:flex and height: 100vh along with maxHeight: 100vh to achieve fullscreen. And so the height of the element fills the available height by default. Define a height for your element if you do not want the height to be stretch. This problem does not apply to the element's children.

  2. Can I vertically align my container top or bottom?

    There is containerStyle and containerClassName props for you to customize the container! Please refer to alignItems style in CSS

    An example for this solution:

    import React from 'react';
       
    import FullScreenHorizontalScroll from '@groftware/fullscreen-horizontal-scroll';
       
    function App() {
      return (
        <div>
          <div style={{ backgroundColor: 'black', width: 1500, height: 100 }} />
          <FullScreenHorizontalScroll containerStyle={{ alignItems: 'flex-end' }}> // position your container here
            <div style={{ border: '10px solid black', height: 100 }}>
              <div style={{ border: '10px solid red', width: 1500, height: 100 }} />
            </div>
            <div style={{ border: '10px solid black', width: 1500, height: 100 }} />
          </FullScreenHorizontalScroll>
          <div style={{ backgroundColor: 'black', width: 1500, height: 100 }} />
        </div>
      );
    }
       
    export default App;
  3. Why is my element width is being squeeze or stretch when i apply width: 100%, width: auto or flex: 1 style?

    This is because the container uses display: flex which by default it will expand to windows width. And so the elements width will be stretch/squeeze to match the container width.

    You may fix it by giving a fixed width.

  4. The scrolling is wrong when my element has nested children in it

    This is because the container only takes the sibling childrens width to calculate the scrolling. Try to make your nested element expand based on your the children or give a fixed width to fix this issue.

  5. My problem is not listed here.

    Do open a new issue on our Github 🥳

Contact

[email protected]