Giter Club home page Giter Club logo

overflowing's Introduction

Overflowing.js

A small jQuery plugin that traverses up the dom and checks to see if it is overflowing any of its parent elements.

Getting Started

Include jQuery and the plugin on a page. Then select an element and call the overflowing method, optionally passing in a limiting element and a callback function. By default overflowing will traverse the dom up to and including the window. You can optionally pass in a parent element in which Overflowing.js will stop at and include in the calculations.

If you are using the callback function you can use the overflowed argument to get the element being overflowed. The callback is fired for each element that is overflowed.

<body>
  <div class="parentElement">
    <div class="middleElement">
      <p class="targetElement"></p>
    </div>
  </div> 
  <script src="jquery.js"></script>
  <script src="jquery.overflowing.js"></script>
  <script>
    $('.targetElement').overflowing('.parentElement', function(overflowed) { 
      console.log('This element is being overflowed', overflowed)
    })
  </script>
</body>

This setup will check if .targetElement is overflowing any of its parents up to and including .parentElement and logging all the elements it overflows in the callback.

License

Copyright © 2012 Kevin Marx Licensed under the MIT license.

Based on Elving Rodriguez's Overflowed http://elvingrodriguez.com/overflowed

overflowing's People

Contributors

kevinmarx avatar

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.