Coder Social home page Coder Social logo

Comments (1)

jamesflorentino avatar jamesflorentino commented on July 21, 2024

hi @mgartner you can only apply the scroll bar on a DOM element (e.g. a div layer) with a .nano class in it. If you want your iframe to have it, you'll have to do a couple of hacks.

Step 1. Set the iframe's overflow to hidden.

iframe{
  border: 0;
}

Step 2. Make a root container in the iframe's html content to wrap all your elements there.

<!-- iframe-content.html -->
<div id="root-container" class="nano">
  <!-- your html content here -->
</div>
<script>$('.nano').nanoScroller();</script>

Step 3. Set the CSS of that root container to width:100%; height:100%; margin:0; padding:0;

#root-container.nano {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
}

To note: NanoScroller doesn't replace the native gadget UI. It merely hides it from the viewport and then adds a custom scrollbar gadget.

Hope this solves your problem.

Cheers
James

from nanoscrollerjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.