Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="root"></div>
              
            
!

CSS

              
                body {
  height: 100vh;
  width: 100vw;
  overflow-x: hidden;
  margin: 0;
  display: grid;
  place-items: center;
}
#scroll {
  position: absolute;
  top: 5%;
  left: 45%;
}
#button {
  background-color: blue;
  display: block;
  width: fit-content;
  color: #fff;
}
.div_max_content {
  width: max-content;
  img {
    height: 70vh;
  }
}
.modal_wrapper {
  width: 100%;
  overflow-x: hidden;
  heigth: auto;
}
.space {
  width: 100%;
  height: 100vh;
}
.photo_session_wrapper {
  display: flex;
  flex-direction: row;
  overflow-y: scroll;
  -ms-overflow-style: none;
  scrollbar-width: none;
  overflow-x: hidden;
}

              
            
!

JS

              
                import React, {
  useRef,
  useEffect,
  useState
} from "https://cdn.skypack.dev/react@17.0.1";
import ReactDOM from "https://cdn.skypack.dev/react-dom@17.0.1";
import reactModal from "https://cdn.skypack.dev/react-modal";
import Modal from "https://cdn.skypack.dev/react-modal";
import reactIntersectionObserver from "https://cdn.skypack.dev/react-intersection-observer";
import { useInView } from "https://cdn.skypack.dev/react-intersection-observer";

const App = () => {
  const [modalIsOpen, setIsOpen] = useState(false);

  function openModal() {
    setIsOpen(true);
  }

  function closeModal() {
    setIsOpen(false);
  }

  const scrollContainer = document.querySelector("#Image-gallery");

  const [ref, isVisible] = useInView({
    threshold: 0.5
  });

  useEffect(() => {
    if (isVisible) {
      console.log("visible");
      scrollContainer.addEventListener("wheel", (evt) => {
        evt.preventDefault();
        scrollContainer.scrollLeft += evt.deltaY;
      });
    } else {
      console.log("not visible");
    }
  }, [isVisible]);

  return (
    <>
      <div onClick={openModal} id="button">
        open modal
      </div>

      {modalIsOpen && (
        <Modal isOpen={modalIsOpen}>
          <div className="modal_wrapper">
            <div onClick={closeModal} id="button">
              Close modal
            </div>
            <div id="scroll">scroll down</div>
            <div className="space"></div>
            <section
              id="Image-gallery"
              ref={ref}
              className="photo_session_wrapper"
            >
              <div className="pin_wraper">
                <div className="animation-wrap to-right">
                  <div className="div_max_content">
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                    <img src="https://images.unsplash.com/photo-1544376798-89aa6b82c6cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8M3x8dmVydGljYWx8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60" />
                  </div>
                </div>
              </div>
            </section>
            <div className="space"></div>
          </div>
        </Modal>
      )}
    </>
  );
};

ReactDOM.render(<App />, document.getElementById("root"));

              
            
!
999px

Console